Implement error handling with Transact-SQL

Advanced
Data Analyst
Data Engineer
Data Scientist
Database Administrator
Developer
Solution Architect
Student
Azure SQL Database
Azure SQL Managed Instance
SQL Server on Azure Virtual Machines
Azure SQL Server on Virtual Machines
SQL Server

Transact-SQL is a powerful declarative language that lets you explore and manipulate your database. As the complexity of your programs increase, so does the risk of errors occurring.

Learning objectives

After completing this module, you will be able to:

  • Raise errors using the RAISERROR statement.
  • Raise errors using the THROW statement.
  • Use the @@ERROR system variable.
  • Create custom errors.
  • Create alerts that fire when errors occur.

Prerequisites

Before starting this module, you should have experience of programming with Transact-SQL.