Export table row to XML file using a stored procedure

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rsdev
    New Member
    • Jul 2007
    • 149

    Export table row to XML file using a stored procedure

    Hi,

    I'm trying to find a way to create an XML file from an SQL table row using a stored procedure.

    This is what I have so far, but it is incomplete;

    Code:
    CREATE PROCEDURE dbo.xml_header
    	@page_id varchar(50)
    AS
    	SET NOCOUNT ON
    	
    	bcp "SELECT * FROM page_headers WHERE page_id=@page_id FOR XML AUTO,ELEMENTS,ROOT('customers')" queryout "App_data\header + @page_id +.xml -Slocalhost -U -P"
    Any hellp appreciated.
  • rsdev
    New Member
    • Jul 2007
    • 149

    #2
    Hmmm!

    Looking further into this and it seems bcp and stored procedures aren't as easy as all that.

    But I might have found the answer here;

    http://www.perfectxml. com/Articles/XML/ExportSQLXML.as p.

    Thanks.

    Comment

    Working...