In an insert trigger I use table 'INSERTED'
to get the inserted values.
Do I use same INSERTED
table in update trigger as well, or here comes in an 'UPDATED'
table?
views:
51answers:
3
+1
A:
Yes, for the new values, you do. For the values being replaced, you use the same DELETED
virtual table as in a delete trigger.
David M
2009-12-12 18:21:46
+2
A:
INSERTED
contains the new values and DELETED
contains the old values.
klausbyskov
2009-12-12 18:24:46
A:
Just a note to augment the other answers - INSERTED and DELETED are available to triggers, but also to the OUTPUT clause.
If you're just doing relatively simple tasks, such as selecting or storing the inserted/updated data, the OUTPUT clause can help you avoid using triggers altogether, which is advantageous as triggers tend to be rather transparent.
womp
2009-12-12 18:37:33