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?