These are the G and G1 tables
create trigger tr123 on G for insert,delete
as
begin
insert into G1 select id,name,getdate(),'INSERT' FROM inserted
insert into G1 select id,name,getdate(),'DELETE' FROM deleted
end
create trigger tr456 on G after update
as
begin
if update(name)
begin
insert into G1 select id,name,getdate(),'NEW' FROM inserted
insert into G1 select id,name,getdate(),'OLD' FROM deleted
end
end
No comments:
Post a Comment