Chapter 7. Error Handling

Great designers aren't afraid of complexity, and some of the best are drawn to it. But their goal is to make the seemingly complex simple.

Steve McConnell[1]

[1] McConnell, Steve. After the Gold Rush. Redmond, WA: Microsoft Press, 1999. Page 26.

In this chapter we'll talk about the conventional ways of raising and handling errors in stored procedures, as well as some of the quirks you may run into with Transact-SQL error management. Transact-SQL's error-handling facilities work reasonably well, but they don't always work in the most logical fashion or as consistently as we might like. Even if you're careful to add error-handling code to every stored procedure on your server, you can't rely on it to work 100% of the ...

Get Guru's Guide to SQL Server™ Stored Procedures, XML, and HTML, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.