急!郁闷!表同步使用触发器的问题
有同太机器有2个数据库,有几个表要实时同步,表结构相同,其中id为自增字段,我写好触发器,2边表同时加上触发器就有错误,只反再一边的表就时好的,请大家帮我看看,哪里有问题
表1的触发器
create TRIGGER Web_Insert on Web.dbo.表1
for Insert
as
if not exists(select sid from OA.dbo.表1 where sid =(select id from inserted) )
begin
insert into OA.dbo.表1
(sid,Name,corid,password,city,industry,link,fax,address,code,
tel,email,licen,time,memo,Flag,Submit)
select id,Name,corid,password,city,industry,link,fax,address,code,
tel,email,licen,time,memo,Flag,Submit from inserted
end
表2的触发器
create TRIGGER OA_Insert on OA.dbo.表1
for Insert
as
if not exists(select sid from Web.dbo.表1 where sid =(select id from inserted) )
begin
insert into Web.dbo.表1
(sid,Name,corid,password,city,industry,link,fax,address,code,
tel,email,licen,time,memo,Flag,Submit)
select id,Name,corid,password,city,industry,link,fax,address,code,
tel,email,licen,time,memo,Flag,Submit from inserted
end