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

Solution: Add error handling to a stored procedure - SQL Server Tutorial

From the course: Program Databases with Transact-SQL

Start my 1-month free trial

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…

Contents