Question: 5 . Write a script that creates and calls a stored procedure named spUpdateInstructor that updates the AnnualSalary column in the Instructors table. This procedure
Write a script that creates and calls a stored procedure named spUpdateInstructor that updates the AnnualSalary column in the Instructors table. This procedure should have one parameter for the instructor ID and another for the annual salary.
If the value for the AnnualSalary column is a negative number, the stored procedure should raise an error that indicates that the value for this column must be a positive number.
Code at least two EXEC statements that test this procedure.
Create a trigger named Instructors UPDATE that checks the new value for the AnnualSalary column of the Instructors table. This trigger should raise an appropriate error if the annual salary is greater than or less than
If the new annual salary is between and this trigger should modify the new annual salary by multiplying it by That way, a monthly salary of becomes an annual salary of
Test this trigger with an appropriate UPDATE statement.
Create a trigger named Instructors INSERT that inserts the current date for the HireDate column of the Instructors table if the value for that column is null.
Test this trigger with an appropriate INSERT statement.
Create a table named InstructorsAudit. This table should have all columns of the Instructors table. Also, it should have an AuditID column for its primary key and a DATETIME column named DateUndated.
Create a trigger named Instructors UPDATE. This trigger should insert the old data about the instructor into the InstructorsAudit table after the row is updated and set the DateUpdated column to the current date and time.Then, test this trigger with an appropriate UPDATE statement.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
