Question : Trigger on Table?

I have a table that I want to put a trigger on so that if an entry is : Inserted, Upated or Deleted it inserts an entry into a Log Table.

Whats the best way of doing this?

Answer : Trigger on Table?

create trigger trname on tablename
after insert, update
as
begin
insert into logtable(fieldlist)
select fieldlist
from inserted
end

have another for the delete

create trigger trname_d on tablename
after delete
as
begin
insert into logtable(fieldlist)
select fieldlist
from deleted
end
Random Solutions  
 
programming4us programming4us