Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Exporting an XML output

Author  Topic 

Gigi
Starting Member

23 Posts

Posted - 2009-04-09 : 11:13:50
Hello all,
I am somewhat stuck while trying to export a XML result set generated from a SQL query. The SQL Query is

Select * from tablename
FOR XML auto, elements

What I would like is that the result be exported to a local folder destination as an xml file.

I have tried various SSIS tasks but they have not been of much help. I would appreciate if anyone can bail me out here.....again :)

ashishashish
Constraint Violating Yak Guru

408 Posts

Posted - 2009-04-10 : 02:06:38
May Be lie this.....u want

EXEC master..xp_cmdshell 'bcp "select * from Dbname.Schema.tablename for XML AUTO,elements" queryout D:\myfile1.xml -Sservername -Uusername -Ppassword -c -r -t'

Thanks
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-04-10 : 06:49:05
http://msdn.microsoft.com/en-us/library/ms191184.aspx
Go to Top of Page
   

- Advertisement -