2

I am executing an sql script through a batch file

sqlcmd /S<machine> /Usa /Paaa123  /i "<sql file>" > "results.txt" 

After the above gets executed the resultant file has "(8890 rows affected) " as a part of the result file which I want to suppress.

JSS
  • 51
  • 6

3 Answers3

1

Well, if you don't want to export the result of the query execution, just remove the > "results.txt" part.

sqlcmd /S /Usa /Paaa123 /i "" is what you should run

Radu Gheorghiu
  • 20,049
  • 16
  • 72
  • 107
1

Try this:

sqlcmd /S<machine> /Usa /Paaa123  /i "<sql file>" | findstr /v /c:"rows affected" > "results.txt"
Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
1

Try this:

sqlcmd /S<machine> /Usa /Paaa123  /i "<sql file>" | findstr /v /g:"file with unwanted spam" > "results.txt" 
Endoro
  • 37,015
  • 8
  • 50
  • 63