From the course: Complete Guide to Advanced SQL Server

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

Challenge: Create a transaction

Challenge: Create a transaction

For the third challenge of this course, I'd like to pull from what we've seen about creating stored procedures and combine it with some of our new knowledge about transactions. This will be a two-part challenge. We'll start building a solution now, and then finish it up at the end of the next chapter. So what is it that we want to do? In the 04_06_Challenge-Start.sql file is some code to build a BankAccounts table and then add a couple of rows of data. Your goal is to write a stored procedure that will allow you to easily transfer money from one account to the other. Your solution should include parameters that you can pass into the stored procedure, and then wrap the commands inside of a transaction so that the database will always be in a consistent state. Finally, test out your solution by transferring $50 from Account Number 1 to Account Number 3. This solution should take about 10 minutes or less to complete. In the next movie, I'll share my solution, and in the next chapter…

Contents