SQL Server – stop or break execution of a SQL script

Is there a way to immediately stop execution of a SQL script in SQL server, like a “break” or “exit” command?

I have a script that does some validation and lookups before it starts doing inserts, and I want it to stop if any of the validations or lookups fail.

21 Answers
21

Leave a Comment