I have a trigger for auditing purchase and sales table. The trigger is on INSERT and DELETE. To check if its “Insert”, the condition is
IF (SELECT COUNT(*) FROM INSERTED) > 0
BEGIN
END
How do I check if its an Update command inside the Trigger?
Arun
The “tables” that are in play in an update trigger are still called
insertedanddeleted, and the old values of the rows are in thedeletedtable, and the new values are in theinsertedtable.You can use logic along these lines to detect whether you are in a insert, update or a delete: