SQL Server 2012: Transact-SQL Error Handling

Learn how to write Transact-SQL code that deals correctly with anticipated and unanticipated errors during code execution, for developers and DBAs from SQL Server 2005 onward
Course info
Rating
(233)
Level
Intermediate
Updated
Aug 21, 2013
Duration
1h 21m
Table of contents
Description
Course info
Rating
(233)
Level
Intermediate
Updated
Aug 21, 2013
Duration
1h 21m
Description

Robust Transact-SQL coding practices dictate proactive planning for anticipated and unanticipated errors that might occur during code module execution. SQL Server’s flavor of Transact-SQL provides several commands that can be used to properly handle errors in your code and this course will cover the fundamental commands you’ll need to know, as well as effective error handling techniques that will help you properly handle issues for high throughput, mission-critical data tiers. This course is perfect for developers, DBAs, and anyone responsible for writing Transact-SQL code, from complete beginners through to those with more experience. The information in the course applies to all versions from SQL Server 2005 onward, with some emphasis on new SQL Server 2012 commands.

About the author
About the author

Joe Sack is a Principal Program Manager in the SQL Server and Azure SQL Database product team at Microsoft, with a focus on query processing. With over 19 years of experience in the industry, Joe is an author and speaker, specializing in performance tuning and optimization.

More from the author
More courses by Joe Sack
Section Introduction Transcripts
Section Introduction Transcripts

Course Introduction
Hi this is Joe Sack from SQLskills. com and I'm recording this course for Pluralsight. This is the SQL Server 2012 Transact-SQL Error Handling course, and you're watching the introduction where I'll briefly describe what to expect over the modules that make up this course. Transact-SQL offers native commands, functions, and constructs that could be used to handle both planned and unplanned errors. Before SQL Server 2005 there were limited error handling capabilities that you could implement in your T-SQL code. But in 2005 and onward, the general error handling story has significantly improved. So in this course we'll cover the key error handling commands, functions, and constructs, as well as common error handling patterns and techniques.

Command Fundamentals
Hi this is Joe Sack from SQLskills. com and I'm recording this course for Pluralsight. This is the SQL Server 2012 Transact-SQL Error Handling course, and you're watching module two where we'll be covering the available Transact-SQL Error Handling Command Fundamentals. SQL Server provides various methods for error handling in your T-SQL code, and in this module I'll introduce you to these various error handling techniques, commands, and constructs. I'll walk through command syntax including required and optional arguments, and I'll follow up with syntax review with demos that showcase the strengths and weaknesses of each command and construct.

Message Handling
Hi this is Joe Sack from SQLskills. com and I'm recording this course for Pluralsight. This is the SQL Server 2012: Transact-SQL Error Handling course, and you're watching module three where we'll go over how to manage predefined messages as part of an error handling solution. Error handling can encompass both user-defined and system error messages. And when it comes to the error messages themselves, you can define and raise your own user-defined messages including predefining messages ahead of time and then storing them on a SQL Server instance. Alternatively you can raise messages without predefining them on the SQL Server instance. And there really isn't a clear cut right or wrong way of doing it, other than making sure that you apply your standards consistently. This module will go through the various considerations and techniques you should understand about overall predefined message handling.

Error Handling Techniques
Hi this is Joe Sack from SQLskills. com and I'm recording this course for Pluralsight. This is the SQL Server 2012: Transact-SQL Error Handling course, and you're watching module four where we'll put together the concepts covered in the previous modules, and show the various techniques you can use to handle errors in your own T-SQL code. I've been covering the key building blocks that you can use in SQL Server to facilitate T-SQL error handling. And in this module I'll tie the various concepts together and show you error handling templates for planned and unplanned errors, how to use error logging tables to track error history, and also an example of using error handling to recover from deadlock events.