I have a query with xml results as output. But in this query I want to save this xml file to a local folder (eg. c:/temp) so I can schedule this query. I have tried to fix it in the job itself to save it as a file but then the XML is not the same as in the query. And it must be the same as in the query below because that is the way it must be imported in another program.
I'm using the following query:
replace (sum (abs(convert(decimal(10,2), amountpaid))), ',', '.') as amountpaid,
date as date,
where journalized > GETDATE() -1
group by date, journal, finyear, invoice, currency, customer
for XML PATH('customerpayment'),