Click to See Complete Forum and Search --> : Export Table to Xml using sql


gnr_gattadi@yahoo.com
November 29th, 2007, 02:14 AM
Hi All,

Is there any Query to Export Table to Xml File Using Sql Server?


Plz Suggest Me ...

Thx in Advance

KrisSimonis
November 29th, 2007, 03:28 AM
With MS SQL 2005 you can use the 'FOR XML' statement apended to a query to turn it into XML.

gnr_gattadi@yahoo.com
November 29th, 2007, 04:52 AM
Thank you very much simon,

But my problem is to save the whole table data in an xmlDocument File;

for ex:
Select * from Tablename to "C:\myxml.xml"


I need a sql query to Export table to xml file.

If any suggestions



Thxxxxxxxxxx

KrisSimonis
November 29th, 2007, 04:56 AM
if you're using MS SQL 2005:


SELECT *
FROM Table
FOR XML AUTO


it's that easy.