Error Checking SQLCMD

I have been executing the SQLCMD instruction from within a DOS scripted bat file, and I get success.
However, if there is an error coming from SSMS (say I want to drop the DB, but it's currently in use) the DOS bat file doesn't see the error and thinks everything is fine.

I need a way to check for errors that come from outside the DOS errorlevel.

I don't know PowerShell. Is that the best way to do this, or something else?

Look at the -b and -V command line options.

1 Like

Brilliant - just brilliant. I failed to read through all the SQLCMD parameters. -b worked perfectly
for me!

Thank you so much.!