Export SQL data to XML format

  • We have data in our SQL Server database that we need to export into an XML file to submit to a vendor.

    The vendor gave us a sample XML file, a schema .xsd file, and various documentation about how to format things, conditional logic for when a value should or should not be included, etc...

    I was wondering what the best way is to do this with SQL Server?

    Do I just build a massive SELECT statement that pulls together the data I need in the way I need it to be and dump that to an XML file?

    Are there third party tools I should examine instead?

    Where I feed the 3rd party tool a sample XML file and then it sort of "mail merges" my data into the appropriate XML fields that are defined and laid out in the sample file?

    Thoughts, suggestions?

  • it depends on the format you need, but you could do it from a select statement using for xml. If you post some sample tables and data as well as the format you want the XML, we could help you out.

    For better, quicker answers, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply