I know this is the easiest question you can find on this website but I wasn't able to find its answer on the internet.
How to check if the trigger was fired by an INSERT
or DELETE
?
Example
CREATE TRIGGER [dbo].[TestTrigger]
On [dbo].[Table1]
AFTER INSERT, DELETE
AS
--if save
--do some work
--else if delete
--do some work other work
I want to do some work if it's an insert and some other work if it is a delete.
Please provide a code snippet for the same.