Difficulty: Easy
Correct Answer: Correct — SQL Server supports INSTEAD OF and AFTER; no BEFORE triggers
Explanation:
Introduction / Context:
Different RDBMS engines implement different trigger types. In SQL Server, understanding which trigger kinds are available helps you implement business rules and updatable views correctly.
Given Data / Assumptions:
Concept / Approach:
SQL Server supports AFTER triggers on tables and INSTEAD OF triggers on both tables and views. BEFORE triggers are not part of SQL Server’s feature set (some other platforms have them). INSTEAD OF triggers are commonly used to make complex views updatable by re-routing DML to base tables.
Step-by-Step Solution:
Create AFTER trigger on a table: valid.Create INSTEAD OF trigger on a view: valid.Attempt a BEFORE trigger: results in syntax error.
Verification / Alternative check:
Check documentation or use SSMS GUI — BEFORE is not an available option; sys.triggers shows AFTER or INSTEAD_OF types only.
Why Other Options Are Wrong:
Claims that BEFORE triggers exist or that only one trigger type exists are incorrect. Compatibility level does not introduce BEFORE triggers.
Common Pitfalls:
Porting code from other databases that use BEFORE triggers without redesigning logic for SQL Server.
Final Answer:
Correct — SQL Server supports INSTEAD OF and AFTER; no BEFORE triggers
Discussion & Comments