create trigger ... on ...
for insert,update,delete
as
   if exists(select 1 from inserted) and not exists(select 1 from deleted)
   begin
      ...此处写insert时的代码...
   end
   if exists(select 1 from inserted) and exists(select 1 from deleted)
   begin
      ...此处写update时的代码...
   end
   if not exists(select 1 from inserted) and exists(select 1 from deleted)
   begin
      ...此处写delete时的代码...
   end