SQLCMD Output vs SSMS Output

  • I have been executing multiple SQL scripts using a batch file with SQLCMD and outputting the results to a text file.

    What I have noticed is that the output differs between using the -o and -r parameters. Also if I run the scripts manually in SSMS the output is different again.

    For example;

    sqlcmd -E -s ServerName -d DBName -i Script1.sql -r > C:\Output\output.txt

    sqlcmd -E -s ServerName -d DBName -i Script2.sql -r >> C:\Output\output.txt

    as opposed to

    sqlcmd -E -s ServerName -d DBName -i Script1.sql -o > C:\Output\output.txt

    sqlcmd -E -s ServerName -d DBName -i Script2.sql -o >> C:\Output\output.txt.

    Has anyone seen this before?

    Thanks

    Steve

  • What is the difference in your outputs?

  • The -o / -r switched gave different levels of detail. The output from running manually in SSMS was different again.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply