Question : SQL Server 2005 Triggers

If a trigger is defined as below, is there a way do definitively know which action fired the trigger or is the best way to split the trigger out ( so to speak )?

1:
2:
3:
CREATE TRIGGER [dbo].[t_MyCoolTrigger] ON [dbo].[MyCoolTable]
FOR INSERT, UPDATE, DELETE  AS

Answer : SQL Server 2005 Triggers

1:
2:
3:
4:
5:
6:
7:
8:
CREATE TRIGGER [dbo].[t_MyCoolTrigger] ON [dbo].[MyCoolTable] 
FOR INSERT, UPDATE, DELETE  AS
BEGIN
SET NOCOUNT ON
IF (EXISTS(SELECT * FROM DELETED) AND (COLUMNS_UPDATED() = 0x0)) PRINT 'DELETE'
IF (EXISTS(SELECT * FROM DELETED) AND (COLUMNS_UPDATED() <> 0x0) AND EXISTS(SELECT * FROM INSERTED)) PRINT 'UPDATE'
IF (NOT EXISTS(SELECT * FROM DELETED) AND EXISTS(SELECT * FROM INSERTED)) PRINT 'INSERT'
END
Random Solutions  
 
programming4us programming4us