Not logged in - Login

Stopping execution of a SQL script

The following will stop the execution of a SQL script:

raiserror('Script execution stopped', 20, -1) with log

The above statement raises an error and disconnects the current connection, thereby stopping execution of the remainder of the script, even if the script has several 'GO' statements in it.