XML - SQL SERVER file creation

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

    SELECT

    1 as Tag

    ,NULL as Parent

    ,tblDocData.DocIdas [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

  • Use ado streams if you are using ado.  Should be a VB example readily available on msdn.  You need to specify the dialect properties on the command object and instance a ADO stream to catch the results and persist them to disk or hand the stream to DOM.

    Things to note you might want to add a processing instruction and (xml schema or dtd references or inlined versions).

    Peter Evans (__PETER Peter_)

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

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