22,207
社区成员
发帖
与我相关
我的任务
分享
create trigger tr_A_Update
on A
for Update
as
update b set
Cstatus =2
from b,inserted i
where b.belongContractno = i.belongContractno
and i.Ostatus = 2
and not exists (
select 1
from a
where belongContractno = i.belongContractno
and isnull(Ostatus,0) <> 2 -- 如果Ostatus不可空,这句应该写成 Ostatus <> 2
)
go
create trigger tr_objectinfo_Update
on objectinfo
for Update
as
update b set
contractstatus=2
from contactinfo b,inserted i
where b.contactno= i.belongContractno
and i.objectstatus= 2
and not exists (
select 1
from objectinfo
where belongContractno = i.belongContractno
and isnull(objectstatus,0) <> 2 -- 如果objectstatus不可空,这句应该写成 objectstatus<> 2
)
go