INSERT, UPDATE, DELETE, :
ALTER TRIGGER [ATrigger] ON [dbo].[A]
FOR INSERT, UPDATE, DELETE
AS
-- those are true INSERTs - the (ID) as primary key is *not* present in the "Deleted" table
INSERT INTO [dbo].[aAudit]([BusinessDate], [DataTypeId], [BookId], [Version], [DelFlag], [AuditDate], [ExtStatus])
SELECT [BusinessDate], [DataTypeId], [BookId], [Version], 'N', getDate(), 0
FROM inserted
WHERE (id) NOT IN (SELECT DISTINCT (id) FROM DELETED)
-- those are true DELETEs - the (ID) as primary key is *not* present in the "Inserted" table
INSERT INTO [dbo].[aAudit]([BusinessDate], [DataTypeId], [BookId], [Version], [DelFlag], [AuditDate], [ExtStatus])
SELECT [BusinessDate], [DataTypeId], [BookId], [Version], 'Y', getDate(), 0
FROM deleted
WHERE (id) NOT IN (SELECT DISTINCT (id) FROM INSERTED)
-- those are the UPDATEs - the (ID) as primary key is present in both the "Inserted" and "Deleted" table
INSERT INTO [dbo].[aAudit]([BusinessDate], [DataTypeId], [BookId], [Version], [DelFlag], [AuditDate], [ExtStatus])
SELECT [BusinessDate], [DataTypeId], [BookId], [Version], 'N', getDate(), 0
FROM Inserted i
INNER JOIN Deleted d on i.ID = d.ID