XML - SQLSERVER file creation

  • I could able to create an xml file from my table using

    SELECT

    1 as Tag

    ,NULL as Parent

    ,tblDocData.DocId as [tbl!1!id]

    ,NULL as [DocDescription!2!]

    ,NULL as [DocData!3!]

    FROM tblDocData

    UNION ALL

    SELECT

    2

    ,1

    ,tblDocData.DocId

    ,tblDocData.Description

    ,NULL

    FROM tblDocData

    UNION ALL

    SELECT 3

    ,1

    ,tblDocData.DocId

    ,tblDocData.Description

    ,tblDocData.DocData

    FROM tblDocData

    ORDER BY [tbl!1!id], [DocDescription!2!], [DocData!3!]

    FOR XML EXPLICIT

    How do I save this as a file in my local directory.

    Thanks & Regards,

    Sreedhar

  • You could put your code into a stored procedure, then use the bcp command to execute the proc and output to a .xml file

    Regards

    Rob

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

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