SQL Server – stop or break execution of a SQL script
The raiserror method raiserror(‘Oh no a fatal error’, 20, -1) with log This will terminate the connection, thereby stopping the rest of the script from running. Note that both severity level 20 or higher and the WITH LOG option are necessary for it to work this way. This even works with GO statements, eg. print … Read more