CREATE TRIGGER dbo.TableName_IUDON dbo.TableNameAFTER INSERT, UPDATE, DELETEAS BEGIN SET NOCOUNT ON; -- -- Check if this is an INSERT, UPDATE or DELETE Action. -- DECLARE @action as char(1); SET @action = 'I'; -- Set Action to Insert by default. IF EXISTS(SELECT * FROM DELETED) BEGIN SET @action = CASE WHEN EXISTS(SELECT * FROM INSERTED) THEN 'U' -- Set Action to Updated. ELSE 'D' -- Set Action to Deleted. END END ELSE IF NOT EXISTS(SELECT * FROM INSERTED) RETURN; -- Nothing updated or inserted. ... END