Question

I have a sql query with for xml explicit clause. Result i need to store in an xml file. I am using a powershell command to do so : invoke-sqlcmd -inputFile $inputFilePath | Out-File -filePath $outputFilePath

this gives me an output file similar to

XML_F52E2B61-18A1-11d1B1000805F49916B

'<'person>dsugfiugds'<'/person>...

'<'student>sdgfdg<\student>'<'id>45<\id>'<'cla...

ss>sdfsdfsfd<....

This file has also been truncated , you can see the ... appears Where as i need the xml to be in the correct format i.e an xml file itself.

No correct solution

OTHER TIPS

Instead of Out-File have you tried Export-Clixml?

 invoke-sqlcmd -inputFile $inputFilePath | Export-Clixml -filePath $outputFilePath
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top