22,300
社区成员




CREATE TRIGGER tr_mys_yz_update ON dbo.mys_yz
FOR UPDATE
AS
if ( update( sfbz) )
begin
--更新手术的收费标志
Update a set sfbz = '1'
from ss_sqd a inner join inserted b on a.djh = b.sqdbh and b.sqdfl = 'ss'
inner join deleted c on b.yzh = c.yzh and b.yzxh = c.yzxh and isnull( b.sfbz,'0' ) = '0' and isnull(c.sfbz,'0' ) = '1'
--更新检验的收费标志
Update a set sfbz = '1'
from jy_jyd a inner join inserted b on a.jydh = b.sqdbh and b.sqdfl = 'jy'
inner join deleted c on b.yzh = c.yzh and b.yzxh = c.yzxh and isnull( b.sfbz,'0' ) = '0' and isnull(c.sfbz,'0' ) = '1'
--更新检查的收费标志
Update a set sfbz = '1'
from jc_jcd a inner join inserted b on a.djh = b.sqdbh and b.sqdfl = 'jc'
inner join deleted c on b.yzh = c.yzh and b.yzxh = c.yzxh and isnull( b.sfbz,'0' ) = '0' and isnull(c.sfbz,'0' ) = '1'
end