Interactive Course

Transactions and Error Handling in SQL Server

Learn to write scripts that will catch and handle errors and control for multiple operations happening at once.

  • 4 hours
  • 14 Videos
  • 52 Exercises
  • 560 Participants
  • 3,850 XP

Loved by learners at thousands of top companies:

siemens-grey.svg
whole-foods-grey.svg
lego-grey.svg
mercedes-grey.svg
3m-grey.svg
ikea-grey.svg

Course Description

It is critical to know how to handle errors and manage transactions when programming SQL scripts. Unhandled errors can be very harmful and can cause unexpected situations, such as inconsistent data in your database, or even worse, errors can lead you to make wrong business decisions. In this course, you will learn how to handle errors and discover how to manage transactions in case of an error. Additionally, you will study what happens when two or more people interact at the same time with the same data. You will practice all these concepts using two datasets, one of them based on bank accounts and the other one on an electric bike store.

  1. Raising, throwing and customizing your errors

    In this chapter, you will deepen your knowledge of handling errors. You will learn how to raise errors using RAISERROR and THROW. Additionally, you will discover how to customize errors.

  2. Controlling the concurrency: Transaction isolation levels

    This chapter defines what concurrency is and how it can affect transactions. You will learn exciting concepts like dirty reads, repeatable reads, and phantom reads. To avoid or allow this reads, you will explore, one by one, the different transaction isolation levels.

  1. 1

    Starting with error handling

    Free

    To begin the course, you will learn how to handle errors using the TRY...CATCH construct that provides T-SQL. You will study the anatomy of errors, and you will learn how to use some functions that can give you information about errors.

  2. Raising, throwing and customizing your errors

    In this chapter, you will deepen your knowledge of handling errors. You will learn how to raise errors using RAISERROR and THROW. Additionally, you will discover how to customize errors.

  3. Transactions in SQL Server

    In this chapter, you will be introduced to the concept of transactions. You will discover how to commit and rollback them. You will finish by learning how to return the number of transactions and their state.

  4. Controlling the concurrency: Transaction isolation levels

    This chapter defines what concurrency is and how it can affect transactions. You will learn exciting concepts like dirty reads, repeatable reads, and phantom reads. To avoid or allow this reads, you will explore, one by one, the different transaction isolation levels.

What do other learners have to say?

Devon

“I've used other sites, but DataCamp's been the one that I've stuck with.”

Devon Edwards Joseph

Lloyd's Banking Group

Louis

“DataCamp is the top resource I recommend for learning data science.”

Louis Maiden

Harvard Business School

Ronbowers

“DataCamp is by far my favorite website to learn from.”

Ronald Bowers

Decision Science Analytics @ USAA

Miriam Antona
Miriam Antona

Software Engineer

Miriam Antona has 10+ years of experience working as a Software Engineer. She is focused on analyzing, designing, and developing software applications for Civil Services and Justice Administration. Miriam loves programming and experimenting with different technologies. She is passionate about databases and enjoys playing with data. She holds a Master of Science Degree in Computer Engineering.

See More
Icon Icon Icon professional info