How to convert the Binary value to XML Format


I have stored the binary value in Table Document with Image datatype

Document(Image, notnull)

i tried to reterive the binary value to XML format.

Select convert (xml, "0x504B0304140000000800000000001F267CB31201000018030000130000005B436F6E74656E745F54797065735D2E786D6CAD924D4FC3300C86FF4A942B6AD271")

but this is not wroking, it return the same binary value. Could you please correct the query .


select image
from table
for xml path('')

Looking at the data, I can tell it's compressed with PKZIP. You will have to uncompress the content before converting it into XML.