Not exactly sure what you're trying to accomplish, but you can test if it's an UPDATE
if both inserted
(values after update) and deleted
(values before update) exist. From the documentation:
The deleted table stores copies of the affected rows during DELETE
and UPDATE statements. During the execution of a DELETE or 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.
The inserted table stores copies of the affected rows during
INSERT and UPDATE statements. During an insert or 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.
Thus, if inserted
exists but not deleted
, it's an INSERT
; if deleted
exists but not inserted
, it's a DELETE
; if they both exist, it's an UPDATE
.