Difficulty: Easy
Correct Answer: AFTER trigger.
Explanation:
Introduction:
AFTER triggers are commonly used for auditing, denormalized updates, and enforcing post-conditions once a DML operation has succeeded. Differentiating them from INSTEAD OF triggers is vital for correct design.
Given Data / Assumptions:
Concept / Approach:
An AFTER trigger runs after the base DML completes. The inserted and deleted pseudo-tables contain the final row versions, enabling audit and business rule checks that rely on successful persistence.
Step-by-Step Solution:
1) Determine whether the trigger runs before, after, or instead of DML.2) AFTER matches the requirement ”after the SQL command has been processed”.3) Select AFTER trigger.
Verification / Alternative check:
Create an AFTER UPDATE trigger and verify it fires only when the update succeeds and is not rolled back in compilation.
Why Other Options Are Wrong:
Common Pitfalls:
Expecting a BEFORE trigger timing like Oracle or PostgreSQL; SQL Server provides INSTEAD OF for pre-logic.
Final Answer:
AFTER trigger.
Discussion & Comments