课程: Program Databases with Transact-SQL

今天就学习课程吧!

今天就开通帐号,24,100 门业界名师课程任您挑!

Challenge: Add error handling to a stored procedure

Challenge: Add error handling to a stored procedure - SQL Server教程

课程: Program Databases with Transact-SQL

Challenge: Add error handling to a stored procedure

(upbeat electronic music) - [Instructor] For the last challenge of this course, I'd like you to return to the stored procedure that was developed at the end of the previous chapter. If you remember, we created a procedure that contained a transaction that would help transfer money from one bank account to another. Now it's time to add some error handling to the procedure. You can either continue developing your own procedure or use the 05_06_Challenge-Start.sql file to pick up with a solution that I came up with. The goal of the challenge is to gracefully handle three different situations. First, make sure that the account that the money is coming from won't fall below a zero balance. We don't want to allow anyone to overdraft their account. Second, make sure that the money is coming from an account that actually exists. And third, it's probably a good idea that the account the money is going into also exists. Only complete the transfer once all three of these conditions are met. I…

内容