Exception Handling Prior to SQL Server 2005

The support for exception handling in SQL Server 2000 had several limitations. It was nonstructured, it was awkward, and it wasn’t capable of trapping all errors.

The main tool it provided you for exception handling was the @@error function, which returned an integer representing the way the last statement terminated (with 0 indicating success and a non-zero error code indicating lack of success). You had to assign the value of @@error to your own local variable immediately after each suspect statement. Otherwise, you’d lose that value, as it would be overridden by the statement that followed the suspect one. Then you had to switch between the possible error codes and determine a course of action. You ...

Get Inside Microsoft® SQL Server™ 2005 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.