5 pts.
 Export XML from SQL Server 2000
We currently use a DTS package to extract data from the db and export it in an XLS file, or in some cases a TXT file. We now need to be able to export as an XML file. Since SQL Server 2000 DTS functions do not appear to support this directly, can anyone give us guidance on how to proceed?

Software/Hardware used:
ASKED: August 18, 2008  6:36 PM
UPDATED: August 19, 2008  3:03 PM

Answer Wiki:
The easiest way is to use the BCP command. Take the SELECT command which will create the XML (either using the FOR XML AUTO or the FOR XML EXPLICIT commands) and put it within a stored procedure. Use BCP and using the Query Out command give it the stored procedure name to run. <pre>bcp "YourDatabase.dbo.YourProcedure" QUERYOUT "D:YourFile.xml" ...</pre>
Last Wiki Answer Submitted:  August 19, 2008  3:02 pm  by  Denny Cherry   64,520 pts.
All Answer Wiki Contributors:  Denny Cherry   64,520 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Check out my SQL Server blog “SQL Server with Mr Denny” for more SQL Server information.

 64,520 pts.