TRY…CATCH in SQL Server 2005
An Easier Approach to Rolling Back Transactions in the Face of an Error.
Also realize that not all errors generating by the TRY block statements are
passed onto the CATCH block. Any errors with a severity of 10 or less are
considered to be warnings and do not branch control flow to the CATCH block.
Also, any errors that sever the database connection will not cause the CATCH
block to be reached.
Try/Catch Block in SQL Server 2005Not all errors can be trapped by a TRY/CATCH block. The first types of
errors that are not trapped are compile errors, like a syntax error within a
batch of T-SQL statements. Another type of error is deferred name
resolution errors created by statement level recompilations. If a process
is terminated by a KILL command then a TRY/CATCH block does not capture this
error. Client interrupt requests or broken client connections are also not
trapped by the TRY/CATCH block. For errors that are not trapped, SQL Server
2005 passes control back to the application immediately, without executing
any CATCH block code.