Multiple choice technology databases

You have an accounting SQL Server database application that is accessed by 50 users on your company network. When a user inserts or updates a record, you want to make sure that all the required columns have appropriate values. Which of the following would be best for this situation?

  1. A stored procedure and a trigger

  2. A batch and a trigger

  3. An UPDATE TRigger and an INSERT trigger

  4. One trigger by itself

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

A single trigger for both INSERT and UPDATE operations can validate that required columns have appropriate values whenever data is modified. The trigger can check both operations using the inserted table, which is available for both INSERT and UPDATE triggers. Combining both operations in one trigger is simpler than maintaining separate triggers.