Tag Info

New answers tagged


Check MS documentation. Specifically the top line: The THROW statement honors SET XACT_ABORT RAISERROR does not. New Applications should use THROW instead of RAISERROR. I believe that is your problem, right there. https://msdn.microsoft.com/en-us/library/ms188792.aspx


The -b parameter applies to the batch, not statements within the script. If you separate each statement with a GO batch terminator, you will get the behavior you expect. Remember that SQLCMD sends the entire batch of statements at once to SQL Server for execution. You'll need T-SQL control flow statements (including TRY/CATCH) to handle errors on the ...

Top 50 recent answers are included