O'Reilly logo

SQL Server MVP Deep Dives by Greg Low, Paul Randal, Kimberly Tripp, Adam Machanic, Kalen Delaney, Paul Nielsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6. Error handling in SQL Server and applications

Bill Graziano

Prior to SQL Server 2005, error handling was limited to testing @@ERROR after each statement. This required users to write lots of similar code to do error handling. The introduction of TRY...CATCH blocks in Transact-SQL (T-SQL) gives the developer more options to detect and handle errors. It is now possible to completely consume errors on the server. Or if you’d like, you can return specific errors back to the client.

The .NET development languages also have a series of classes for SQL Server error handling. These can be used to process errors and capture informational messages from SQL Server. The combination of TRY...CATCH on the server and the SQL Server–specific error ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required