答案:CREATE OR REPLACE TRIGGER trg_A
after update
of aa
ON a
referencing new as new old as old
for each row
declare
begin
if :new.aa<>:old.aa then
update B set aa=:new.aa where A.XX=B.XX;
end if;
exception
when others then
null;
end trg_A;其他:楼上已经回答得非常到位了。 --即时同步两个表的实例:
--测试环境:SQL2000,远程主机名:xz,用户名:sa,密码:无,数据库名:test
--创建测试表,不能用标识列做主键,因为不能进行正常更新
--在本机上创建测试表,远程主机上也要做同样的建表操作,只是不写触发器
if exists (select * from dbo.sysobjects where id = object_id(N'[test]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [test]
create table test(id int not null constraint PK_test primary key
,name varchar(10))
go
--创建同步的触发器
create trigger t_test on test
for insert,update,delete
as
s