exporting xml from sql server

  • Greetings

    lets say i have a table Employee like this

    EmpID,EmpName

    1 ,hatemand

    i write a query that select * from Employee for xml autoso the out put will be in xml formati want some help to know how can i export the result to a xml file to be saved on my computer as i need to read the .xmls files from this folder and deserialize them in my .net application

    thnx

  • Either SSIS, OpenRowset (to a text file), or sp_OACreate to use the Scripting.FileSystemObject to write the data out.

    Wayne
    Microsoft Certified Master: SQL Server 2008
    Author - SQL Server T-SQL Recipes


    If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
    Links:
    For better assistance in answering your questions
    Performance Problems
    Common date/time routines
    Understanding and Using APPLY Part 1 & Part 2

  • Do you have to store it on the disk?

    Why not storing the xml results in a separate table (file name in one column, xml data in a xml column, one row per "file") and read it from the table?

    Question aside: What do you mean by "deserialize"?



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • LutzM (10/15/2010)


    Do you have to store it on the disk?

    Why not storing the xml results in a separate table (file name in one column, xml data in a xml column, one row per "file") and read it from the table?

    Good questions... I was assuming that the XML file would need to be transferred to another party.

    Wayne
    Microsoft Certified Master: SQL Server 2008
    Author - SQL Server T-SQL Recipes


    If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
    Links:
    For better assistance in answering your questions
    Performance Problems
    Common date/time routines
    Understanding and Using APPLY Part 1 & Part 2

Viewing 4 posts - 1 through 3 (of 3 total)

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