You are a database administrator for AIOTestKing.com. The company uses a SQL Server 2005 database that includes a table named Inventory. The table contains a column named Price. A company policy states that the value in the Price column cannot be decreased by more than 10 percent in any single database operation. Updates to the Price column are made by various means, including by using ad hoc queries. You need to ensure that this company policy is enforced. What should you do?
A.
On the Price column, create a foreign key constraint to a table that contains valid prices.
B.
On the Price column, create a check constraint that requires a specified minimum value.
C.
Create a trigger that rolls back changes to the Price column that violate company policy.
D.
Create a stored procedure that disallows changes to the Price column that violate company policy.
Explanation:
A trigger would be the easiest way to implement this. When the trigger is fired just rollback to remove the change that violates the company policy.