1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
deleted table stores copies of the affected rows during
UPDATE statements. During the execution of a
UPDATE statement, rows are
deleted from the trigger table and transferred to the
deleted table. The
deleted table and the trigger table ordinarily have no rows in common.
inserted table stores copies of the affected rows during
UPDATE statements. During an
UPDATE transaction, new rows are added to both the
inserted table and the trigger table. The rows in the
inserted table are copies of the new rows in the trigger table.
UPDATE transaction is similar to a delete operation followed by an
INSERT operation; the old rows are copied to the
deleted table first, and then the new rows are copied to the trigger table and to the
When you set trigger conditions, use the
deleted tables appropriately for the action that fired the trigger. Although referencing the
deleted table when testing an
INSERT or the
inserted table when testing a DELETE does not cause any errors, these trigger test tables do not contain any rows in these cases.