This will depend on what you are returning the XML to. .NET's XML classes, for example, contain methods for dealing with this. Tell me where the XML is going and I will try to give you some pointers.
The returned XML contains the image field coded in binary base64 format. Should I convert it from base64 to hexadecimal? Or should I use another way of getting the xml without using a FOR XML AUTO, BINARY BASE64 clause?
I don't know the format of the OPENXML clause for inserting image fields.
The insert statement looks like as follows:
INSERT INTO MyTable(MyKey, MyImageField) SELECT MyKey, MyImageField FROM OPENXML(@hDoc, '/SqlXml/MyTable', 2) WITH MyTable
Are you secure? For information about the Microsoft Strategic Technology Protection Program and to order your FREE Security Tool Kit, please visit http://www.microsoft.com/security.
To use the function base64tobin I have to get the binary base64 field from the xml and call the function. I use the xml in a stored procedure, so I don't think it's a good idea.
In order to understand my problem, I can read the blob field in the client and process it, but I don't know which format should the xml blob field have, because I need to insert the blob in the server by means of an OPENXML clause. Any help???
OPENXML is flexible enough that you can add the UDF to your XML parsing stored procedure.
Example:
DECLARE @idoc int DECLARE @doc varchar(1000) SET @doc =' <ROOT> <Customer base64data="AFF+=="/> </ROOT>' --Create an internal representation of the XML document. EXEC sp_xml_preparedocument @idoc OUTPUT, @doc -- Execute a SELECT statement that uses the OPENXML rowset provider. INSERT INTO SELECT db.dbo. base64tobin(CustomerID) FROM OPENXML (@idoc, '/ROOT/Customer',1) WITH (CustomerID varchar(8000))
Thanks for the post and I hope that the information was helpful
Drew Minkin, MCDBA, MCSD, MCSE SQL Support Professional, Microsoft Corporation email: dmin...@online.microsoft.com
This posting is provide "AS IS" with no warranties, and confers no rights. Please do not send email directly to this alias. Respond to the newsgroup
Are you secure? For information about the Microsoft Strategic Technology Protection Program and to order your FREE Security Tool Kit, please visit http://www.microsoft.com/security.