bcp to xml

bcp to xml

am 18.11.2007 17:11:21 von Matthew Butler

can someone please advise me on the correct syntax to bcp export executing a
stored procedures results to xml

I know it begins

bcp "exe sp_procedure" queryout

but unser on the rest of the syntax

many thanks

Re: bcp to xml

am 19.11.2007 00:03:22 von Erland Sommarskog

Matthew Butler (matthew.butler@srjdebt.co.uk) writes:
> can someone please advise me on the correct syntax to bcp export
> executing a stored procedures results to xml
>
> I know it begins
>
> bcp "exe sp_procedure" queryout
>
> but unser on the rest of the syntax

I'm not really sure what you have in mind. To start with the procedure
must return XML data, either with FOR XML or the xml data type. And I
don't really think that FOR XML works that well with BCP, at least not
for larger documents.

What does your procedure look like? Which version of SQL Server are you
using?

--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downlo ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books .mspx