Shimmy Weitzhandler
Shimmy Weitzhandler

Reputation: 104692

What table is used in an update trigger?

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?

Upvotes: 2

Views: 113

Answers (3)

womp
womp

Reputation: 116977

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.

Upvotes: 0

Klaus Byskov Pedersen
Klaus Byskov Pedersen

Reputation: 120917

INSERTED contains the new values and DELETED contains the old values.

Upvotes: 2

David M
David M

Reputation: 72840

Yes, for the new values, you do. For the values being replaced, you use the same DELETED virtual table as in a delete trigger.

Upvotes: 1

Related Questions