Tip (SQL Server): Error Handling in a Stored Procedure
Tips and Tricks for: SQL Server
The Problem: Does SQL Server have anything like VB’s On Error GoTo?To those familiar with Visual Basic, VB provides the option to use the ON ERROR GOTO … clause to catch practically any error and handle it in one’s program.
Does SQL Server 2000 have the analogous clause that will jump to a certain part of code in a stored procedure to handle errors?
Solution: Errors must be checked after every SQL statement of interest.