1

I'm having some trouble dumping a query result into a XML file. I've read many articles about this subject but i still can't reach a decent solution for my case.

I have a procedure that outputs a query in XML format and it's working well:

alter proc pr_export_xml
as
declare @XmlOutput xml
set @XmlOutput = (select id,ref,sit from RepData for XML PATH('Produto'), ROOT('Produtos'), TYPE)

select @XmlOutput
go

What I need now is to get that result and dump into a file for later use. This procedure will be called during a trigger, so the dump into file must be done automatically.

I hope I was clear enough, any help will be appreciated.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Fabio
  • 791
  • 1
  • 7
  • 27
  • 3
    Second part of this article is probably what you need http://blogs.lessthandot.com/index.php/DataMgmt/DBProgramming/create-xml-files-out-of-sql-server-with- – Alex Jan 02 '13 at 11:51

1 Answers1

1

Another alternative for this one is bcp utility.
Look into these.


http://www.brighthub.com/internet/web-development/articles/119542.aspx
Enable 'xp_cmdshell' SQL Server

Community
  • 1
  • 1
Vijay Hulmani
  • 969
  • 8
  • 17