Problem with FOR XML clause

G

Guest

I am trying to persist data from SQL Server 2005 table into an XML file using
FOR XML clause in the SELECT statement. I have a column named “Photo†of type
Image. Issue is; the FOR XML clause is returning the picture as some
reference instead of binary format.
<Photo>dbobject/employees[@EmployeeID='1']/@Photo</Photo>

Writing XML file using DataSet.WriteXml() method persists the same column as
binary format

<Photo>FRwvAAIAAAANAA4AFAAhAP////9CaXRtYXAgSW1hZ2UAUGFpbnQuUGljdHVyZQABBQAAAgAAAAcAAABQQnJ1c2

I have trimmed the above binary string for brevity. The XML file is used for
backing and restoring data in the database.

thanks
 
P

PS

Job Lot said:
I am trying to persist data from SQL Server 2005 table into an XML file
using
FOR XML clause in the SELECT statement. I have a column named "Photo" of
type
Image. Issue is; the FOR XML clause is returning the picture as some
reference instead of binary format.
<Photo>dbobject/employees[@EmployeeID='1']/@Photo</Photo>

Writing XML file using DataSet.WriteXml() method persists the same column
as
binary format

<Photo>FRwvAAIAAAANAA4AFAAhAP////9CaXRtYXAgSW1hZ2UAUGFpbnQuUGljdHVyZQABBQAAAgAAAAcAAABQQnJ1c2

I have trimmed the above binary string for brevity. The XML file is used
for
backing and restoring data in the database.

thanks

It is encoded no doubt, base64. Look at Sql Server help FOR XML.

PS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top