Reputation: 791
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.
Upvotes: 1
Views: 2168
Reputation: 979
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
Upvotes: 1