Steve Jones is done with mousetraps:
This seemed to work, but did it really?
The Problem
Let’s illustrate the big problem with this change. I’ll run this code:
Steve hit on one of the problems in trigger design, but there’s another problem that we often see. Steve’s code doesn’t have this problem, but quite often, people assume that rows update one at a time. But if you write a T-SQL UPDATE
statement that affects five rows, the trigger fires once for all five. Steve correctly uses the inserted
and deleted
pseudo-tables to handle all changes, rather than just assuming a single row.