Trapping Errors and Implementing Error Handling
When working with T-SQL batch processing, errors will occur. You can either learn to handle them or let them handle you. That means when writing your T-SQL scripts, you need to ask yourself, "What should the SQL code do if something goes wrong?" If your batch is a multi-step process and something goes wrong in the middle, should the batch reverse the previous statements, just end, or continue as if nothing happened? Learning how to detect, display, and respond to errors that might occur is very important to the programming process. In this section, you will learn how to use the available global variables that return error information in your SQL scripts.
Communicating Error Messages
When an error ...
Get Sams Teach Yourself Transact-SQL in 21 Days, Second Edition 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.