Problem with FOR XML clause

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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
 
Back
Top