0

I'm using this batch script to export the result of SQL-script in a tab-delimited CSV.

sqlcmd -S PRISHA-CRM  -i "C:\Users\Administrator\Desktop\test.sql" -U essl1 -P essl  -o C:\outputfile.csv  -s " "

screenshot

  1. How to prevent the second row ---------- from appearing in the exported file?
  2. How to prevent the text in B4 cell from appearing in the exported file?

Tried multiple things but it's not working.

wOxxOm
  • 65,848
  • 11
  • 132
  • 136

1 Answers1

0

If you want to remove the dashed lines then pipe your output to the FINDSTR command and then redirect to the output file.

sqlcmd -S PRISHA-CRM  -i "C:\Users\Administrator\Desktop\test.sql" -U essl1 -P essl -s " " | findstr /R /C:"^[^-]*$" >C:\outputfile.csv

Don't know anything about SQLCMD so I don't know why you are getting data in B4.

Squashman
  • 13,649
  • 5
  • 27
  • 36