I have the following script that works great. How can I write the results (select MyXML) to a file?
DECLARE @claimXML XML
declare @myXml xml
SELECT @claimXML = (
de as '@ActionCode',
Status as '@Status',
RecipientName as '@RecipientName',
'' as 'Participant/@FirstName',
'' as 'Participant/@LastName',
SSN as 'Participant/@SSN',
ProviderName as 'Provider/@ProviderName',
AddressLine1 as 'Provider/MailingAddress/@
AddressLine2 as 'Provider/MailingAddress/@
City as 'Provider/MailingAddress/@
StateCode as 'Provider/MailingAddress/@
ZipCode as 'Provider/MailingAddress/@
ExternalClaimNumber as 'ClaimDetail/@ExternalClai
ClaimAmount as 'ClaimDetail/@ClaimAmount'
'true' as 'ClaimDetail/@ReceiptRecei
'false' as 'ClaimDetail/@ClaimOnHold'
ExpenseCategory as 'ClaimDetail/@ExpenseCateg
ExpenseType as 'ClaimDetail/@ExpenseType'
case when ClaimPayeeType ='PTP' then 'Provider Payment'
when ClaimType =''then KeyName
end as 'CustomProperties/@KeyName
case when ClaimPayeeType ='PTP' then KeyValue
when ClaimType =''then KeyValue
end as 'CustomProperties/@KeyValu
FOR XML PATH('Claim'),TYPE)
--Start of XML File Header
SELECT @myXml = (
'Administrator' AS '@AdminAlias',
getdate() as '@CreatedDateTime',
FOR XML PATH('StandardExchange'))