Look in the Sql Server BOL for the 'Deleted' and 'Inserted' tables to find out more about handling the processed records in triggers.
Rhys
""Vampireware /n/, a project, capable of sucking the lifeblood out of anyone unfortunate enough to be assigned to it, which never actually sees the light of day, but nonetheless refuses to die."
Use Inserted or Deleted as described above if you want the ID for the row you have updated.
If you want to know what field you updated use ColumnsUpdated().
IMHO COLUMNS_UPDATED() is hidden trouble maker - it relies on ordinal position of column(s) within a table. Theoretically this is bad thing - whether column 'foo' is 1st, 3rd or 99th shouldn't matter. Practically - trigger might check wrong columns if you don't declare them in exactly the same order. Such logical errors are hard to trace. And if column position is greater than 8, expressions get ugly (bitmask manipulations).
------ "There's a man... He's bald and wears a short-sleeved shirt, and somehow he's very important to me. I think his name is Homer."
(Jack O'Neill, Stargate)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.