Difficulty: Easy
Correct Answer: INSTEAD OF and AFTER only
Explanation:
Introduction / Context:
Triggers in SQL Server fire in response to data modification events. Knowing which trigger types are supported helps in enforcing complex constraints and audit logic.
Given Data / Assumptions:
Concept / Approach:
SQL Server supports AFTER triggers (fire after the DML statement succeeds) and INSTEAD OF triggers (replace the DML operation; useful on views). It does not support BEFORE triggers like some other RDBMS engines.
Step-by-Step Solution:
Verification / Alternative check:
Attempt to create a BEFORE trigger yields an error; documentation shows only AFTER and INSTEAD OF.
Why Other Options Are Wrong:
INSTEAD OF only / AFTER only: incomplete. BEFORE only: unsupported.
Common Pitfalls:
Porting code from engines that support BEFORE triggers without redesign. Overusing triggers where constraints or procedures would be clearer.
Final Answer:
INSTEAD OF and AFTER only
Discussion & Comments