Monday, March 26, 2012

export data from sql server records to XML file

how can I export data from sql select command to XML file ?
thanks
Use ADO or ADO.Net to pipe the result stream into a file stream and use FOR
XML on your select query (see documentation for details about FOR XML).
Best regards
Michael
"daniv" <anonymous@.discussions.microsoft.com> wrote in message
news:26b301c4a728$6c108950$a601280a@.phx.gbl...
> how can I export data from sql select command to XML file ?
> thanks
|||thanks michael, but
of course, i used the for xml in the select, i tried all
variations. what i get are well builded xml strings on
screen. i tried also to make an activex on dts but it
would not recognized the xmldom object.
can i get more details about piping result with ado?
Daniel
>--Original Message--
>Use ADO or ADO.Net to pipe the result stream into a file
stream and use FOR
>XML on your select query (see documentation for details
about FOR XML).
>Best regards
>Michael
>"daniv" <anonymous@.discussions.microsoft.com> wrote in
message[vbcol=seagreen]
>news:26b301c4a728$6c108950$a601280a@.phx.gbl...
file ?
>
>.
>
|||The XML-strings you are recieving - are they XML fragments or XML documents
(do they have XML declararation on top)?
"daniv" <anonymous@.discussions.microsoft.com> wrote in message
news:2a4001c4a89b$2da2fcb0$a401280a@.phx.gbl...[vbcol=seagreen]
> thanks michael, but
> of course, i used the for xml in the select, i tried all
> variations. what i get are well builded xml strings on
> screen. i tried also to make an activex on dts but it
> would not recognized the xmldom object.
> can i get more details about piping result with ado?
> Daniel
> stream and use FOR
> about FOR XML).
> message
> file ?
|||A document is defined to have exactly one XML element at the top. FOR XML
will return a fragment (as many top-level elements as there are rows). You
can set the root node property in the provider (e.g., ADO) to add a wrapper
element (see Books Online for more details).
Best regards
Michael
"Patrick Akerblom" <patrik.akerblom@.ontrax.se> wrote in message
news:u1pZsSiqEHA.3744@.TK2MSFTNGP10.phx.gbl...
> The XML-strings you are recieving - are they XML fragments or XML
> documents (do they have XML declararation on top)?
> "daniv" <anonymous@.discussions.microsoft.com> wrote in message
> news:2a4001c4a89b$2da2fcb0$a401280a@.phx.gbl...
>
sql

No comments:

Post a Comment