Question 530
A user-update trigger contains code assuming one user ID and silently mislogs batch updates. The team proposes this approach: Rewrite trigger set-based to join all inserted/deleted rows and retest. Which technical principle supports this approach?
Explanation
Correct Answer
SQL Server DML triggers execute per statement and inserted/deleted can contain multiple rows. Triggers remain unsuitable for long-running network calls inside a transaction.
Incorrect Answers
One DML statement fires one trigger invocation with inserted/deleted rowsets; set-based joins are essential.
For an UPDATE, inserted has new values and deleted has old values; join by stable row identity to audit transitions.
DML triggers run in the transaction context; costly or failing synchronous work can block or roll back updates.