日期:2014-05-17 浏览次数:20598 次
create table A
(
a int,
b int,
c int,
d int,
e int
);
create table B
(
b int,
c int,
d int
);
CREATE TRIGGER TRI_A ON A
AFTER INSERT
AS
BEGIN
declare @a int,@b int ,@c int ,@d int ,@e int
select @a=a ,@b=b,@c=c ,@d=d,@e=e from inserted i
if @a <>'' --invalid check ,u would write yours business function to replace it
begin
insert into B(b,c,d) select @b,@c,@d
delete a
from A as a,inserted i
where a.a=i.a and a.b=i.b
end else begin
rollback
end
END