Saving the results of a SQL Server 2005 table query in a XML file

Tags:
Query
SQL Query
SQL Server 2005
I have data in a table on a SQL Server 2005, and I need to query this table and save the results in a XML file that conforms to a given XSD. Is there an easy way of doing this?

Answer Wiki

Thanks. We'll let you know when a new response is added.

You’ll want to use the FOR XML clause when you query the table. Unforunately you can’t just give SQL the XSD and have it give you the data. It may take a while to get the hang of the FOR XML clause, but once you do it’ll be easy.

Take a look in Books OnLine under “FOR XML clause” for the syntax information of using the FOR XML clause.

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: