I am using a powershell script which will return an XML from a sqlquery of FOR XML EXPLICIT type. Now, the query returned the XML in a column with header and dashed lines
XML 32776498797309
---------------------
<data>asdsafafaf<\data><value>dfsasfasfdfasdf....
dfdsfsdgregrge<\value><value>asdfasdfadfadfsda<\v
alue>
Here, some how we were able to remove header , dashed line and truncating of data. but still the data comes in new line so if we open the XML it throws error because at some places the tag gets distributed as shown above. Basically, new line issue is there. We tried -width 4096 but since XML is huge it is not proper. Please help, stuck big time.
Query used :
invoke-sqlcmd -inputFile $inputFilePath -serverinstance $dbHostName
-database $dbName -username $userName -password $password
| Format-Table -hide -Wrap -AutoSize
| Out-File -filePath $outputFilePath -width 4096