Groups | Blog | Home
all groups > sql server programming > november 2006 >

sql server programming : Exporting SQL Server 2005 data to XML file


LITO
11/9/2006 11:01:01 PM
What new options do we have on SQL Server 2005 when exporting query output to
an XML file (not using SSIS)?

1) sp_makewebtask -- small results only

2) bcp "EXEC Northwind..sproc_GetShippers" queryout c:\temp\bcpOut.xml -S.
-Usa -P -c -r -t -- must append header and footer files
C:\temp>Copy header.txt+bcpOut.xml+footer.txt result.xml /B

Basically, I want to run a shell which execute a sql file and dump the
result to an xml file.
--
m.bohse NO[at]SPAM quest-consultants.com
11/10/2006 12:15:17 AM

LITO

use sqlcmd.exe, run a Select statement with the FOR XML clause and
write the results to an output file.

Markus
LITO
11/10/2006 9:45:02 AM
I tried what you suggested before posting my inquiry ...


sqlcmd -i CreateXML.sql -S xxx -U xx -P xx -d dbname >> result.xml

when I open the result.xml, the output was not in xml format ...

--
Lito D


[quoted text, click to view]
AddThis Social Bookmark Button