想做一个触发器,允许仅在插入数据时被触发,修改时不被触发。现不管是插入还是修改数据时均被触发,语句如下:CREATE TRIGGER trigger_name
ON 表1
for insert
as
update a
set a.列1=b.列2
from 表1 a,inserted b
where a.id=b.id
ON 表1
for insert
as
update a
set a.列1=b.列2
from 表1 a,inserted b
where a.id=b.id
--insert
end
else if not exists(select 1 from inserted) and exists(select 1 from deleted) begin
--delete
end
else begin
--update
end