SQL-Server Triggers  «Prev  Next»

SQL Server Triggers - Quiz

Each question is worth one point. Select the best answer for each question.
1. Which type of trigger fires **after** the triggering SQL statement successfully completes?
A. INSTEAD OF trigger
B. AFTER trigger
C. RECURSIVE trigger
D. DDL trigger

2. Which trigger type allows you to **replace the original operation**, commonly used with views?
A. AFTER trigger
B. DML trigger
C. INSTEAD OF trigger
D. DDL trigger

3. If a trigger detects invalid data during an INSERT operation, what is the **recommended SQL Server technique** to cancel the operation?
A. ROLLBACK TRANSACTION
B. DELETE FROM inserted
C. TRUNCATE TABLE
D. DISABLE TRIGGER

4. When an UPDATE trigger fires in SQL Server, which statement best describes the **inserted and deleted tables**?
A. Only the inserted table contains rows
B. The inserted table contains new values and deleted contains old values
C. Both tables contain identical rows
D. Only the deleted table contains rows

5. Why should SQL Server triggers be written using **set-based logic instead of assuming a single row**?
A. Triggers only support batch processing
B. Triggers cannot access table data
C. Triggers execute outside transactions
D. One statement may modify multiple rows at once