declare @op char(1) if (select count(*) from deleted) = 0 set @op = 'I' else if (select count(*) from inserted) = 0 set @op = 'D' else set @op = 'U'