Hi, See this simple code: declare @a int = 1 declare @b int = 0 declare @c int begin try set @c = @a / @b end try begin catch raiserror ('ERROR occured' , 16,1) with NOWAIT --print 'ERROR occured' end catch If I run this code, it generates an error (as expected) and the "query is completed with errors". however, if I use the print statement instead of the RAISERROR statement, it still jumps into the catch block. However, the "query executed succesfully" Why is the raiserror variant different compared to the print statement? It has a severity of 16, which is not a value for an error (the code has several RAISERROR(..,16,1) WITH NOLOG fragments to display output)
TRY/CATCH bypasses the default error handling events. When using RAISERROR your re-importing the error handler When using PRINT your creating your own error handler, as the PRINT statement executed successfully, you get a query executed successfully message.