From the course: Program Databases with Transact-SQL
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Solution: Add error handling to a stored procedure - SQL Server Tutorial
From the course: Program Databases with Transact-SQL
Solution: Add error handling to a stored procedure
(upbeat music) - [Narrator] I hope you are able to integrate the error handling that's required in order to ensure that we have a couple of conditions that are met before transferring money from one account to another using our stored procedure. Let's go through how I would approach the solution. Now the first few lines inside of the study file just set it up again in case you weren't following along with the previous challenge, but I already have all of this, I'm just going to select everything from the Bank Accounts table, just so we can see where we're at. And so right now we have our three accounts and the balance after the transfer that we did at the end of the last challenge. So account one has 50, two has 200 and three has $350. So it's got to squeeze this down to the bottom and we'll get that out of the way. So what we want to do is start working with this procedure and add in some error handling. Now in the solution that I came up with at the end of the last chapter was to…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
(Locked)
What is error handling?1m 52s
-
(Locked)
Capture errors with TRY and CATCH4m 54s
-
(Locked)
Generate errors with THROW4m 12s
-
(Locked)
Manage transaction control4m 4s
-
(Locked)
Challenge: Add error handling to a stored procedure1m 12s
-
(Locked)
Solution: Add error handling to a stored procedure12m 12s
-
(Locked)
-
-