日期:2014-05-17 浏览次数:20441 次
use AA1
go
create trigger tr_tebs1 on tebs
for insert
as
begin
insert into AA2.dbo.tebs(B1,B2,B3,B4,B5,B6)
select B1,B2,B3,B4,B5,B6 from inserted
end
use AA2
go
create trigger tr_tebs2 on tebs
for update
as
begin
if update(B1) or update(B2) or update(B3) or
update(B4) or update(B5) or update(B6)
begin
update a
set a.B1=b.B1,a.B2=b.B2,a.B3=b.B3,
a.B4=b.B4,a.B5=b.B5,a.B6=b.B6
from AA1.dbo.tebs a
inner join inserted b on a.[主键字段]=b.[主键字段]
end
end