Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML Output

Status
Not open for further replies.

olypost

Programmer
Apr 15, 2005
43
US
I'm new to sql server and I simply need to get data out of a sql server table into XML format using FOR XML AUTO, ELEMENTS.

When I use the query analyzer or enterprise manager, the XML appears as a stream, for example:

<Customers><CID>100</CID><CO>Name</CO></Customers><Customers><CID>....

Instead, how do I get the output to appear as:

<Customers>
<CID>100</CID>
<CO>Name</CO>
</Customers>
<Customers>
<CID>

Ideally, I'd like the output spooled to a file.

I apologize for such a basic question. Thanks.

 
The XML output appears as a stream because adding carriage returns and linefeeds is only beneficial to humans. Any XML parser you use will work properly if there are no CR/LF's.

If you write a query using Query Analyzer, you can save it to a file by doing this...

Right click in the query window.
Select Results To File

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top