Question: Using the SmartHomes database do the following: Create and run a stored procedure (write code) in SQL Server to take in a customer ID, product

Using the SmartHomes database do the following: Create and run a stored procedure (write code) in SQL Server to take in a customer ID, product ID, and quantity. Test the three executions of the stored procedure (that include valid and invalid data) to help test extraneous information. Explain how the transaction is executed within the stored procedure. To ensure data integrity, we need to validate that the existing quantity of the product table has enough items before the stored procedure is executed. This can be done using a trigger. Create a trigger in SQL Server to execute when the transaction is performed in the stored procedure. The trigger should be based on the update of the product table to check if the current quantity has enough items to deduct the updated quantity. Test three executions of the trigger with various inputs (that include valid and invalid data) to test for extraneous information.

Step by Step Solution

3.36 Rating (149 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Here is the code for the stored procedure T... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!