Triggers have special INSERTED
and DELETED
tables to track “before” and “after” data. So you can use something like IF EXISTS (SELECT * FROM DELETED)
to detect an update. You only have rows in DELETED
on update, but there are always rows in INSERTED
.
Look for “inserted” in CREATE TRIGGER.
Edit, 23 Nov 2011
After comment, this answer is only for INSERTED
and UPDATED
triggers.
Obviously, DELETE triggers can not have “always rows in INSERTED
” as I said above