CREATE TRIGGER xxx_insert ON dbo.tablename FOR INSERT NOT FOR REPLICATION
AS
DECLARE @id1 INT
DECLARE @id3 INT
SELECT @id1= id1, @id3= id3 from inserted
insert into table2 values(@id1,@id3)
AS
DECLARE @id1 INT
DECLARE @id3 INT
SELECT @id1= id1, @id3= id3 from inserted
insert into table2 values(@id1,@id3)
for insert
as
begin
insert table2(id1,id3) select id1,id3 from instered
end
for insert
as
begin
insert into table2 select id1,id3 from instered
end
for insert
as
if exists(select id1 ,id3 from inserted i join tabgle1 t on i.id1=t.id1 and i.id3=t.id3)
begin
insert into table2 select id1,id3 from instered
end