SQL Server中如何用触发器,使A表中插入特定条件数据时,将数据插入相同结构的B表,并删除A中数据?
SQL Server中如何用触发器,使A表中插入特定条件数据时,将数据插入相同结构的B表,并删除A中数据?
日期:2013-04-01 11:47:47 人气:3
create trigger tr_ins_del_tbA
on tbA
instead of insert
as
begin
if exists(select 1 from inserted where errorid=5) begin
insert into tbB select * from inserted where errorid=5
end
insert into tbA select * from inserted where errorid5
end