Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Powershell Invoke-sqlcmd remove suppress column header

$
0
0

Hello,


I am looking for a clean and easy way to suppress a column header from  invoke-sqlcmd. It appears that only sqlcmd supports the -h-1 option to remove the column header from the output. I have used the code below to skip the first 2 rows in order to omit the column header

ExecuteSQLFile $SQLInstance $hsInputFile | Out-File -filePath $hsOutputFile


  (Get-Content $hsOutputFile | Select-Object -Skip 2) | Set-Content $hsOutputFile

Does anyone know of any easier/cleaner way? I know I can export to CSV, but I get double quotes around each row which then need to be removed.  Unfortunately, there is an area of my output that needs double quotes so removing the double quotes becomes problematic.

Thank you


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>