|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册账号
×
触发器是这样写的:
CREATE procedure ufida_zje_3
as --drop procedure ufida_zje_3 /*每15分钟自动执行一次*/
--当表头与表体的定金比例不对时更新表头定金%
--作废,取而代之的是收款单的累计收款额 update so_somain set cdefine16=isnull(100*imoney/(select isnull(sum(mx.inatsum),0) from so_sodetails mx where mx.id=so_somain.id),0) where isnull(cdefine16,0)<>100*imoney/(select isnull(sum(mx.inatsum),0) from so_sodetails mx where mx.id=so_somain.id)
--此触发器要优化成当有新增收款单是才触发,以免影响速度。
update so_somain set cdefine16=
--[
(select sum(apc.iAmount) from ap_closebill apc where apc.cflag='AR' and apc.cdefine11=soa.csocode)*100
/
(select sum(sob1.inatsum) from so_sodetails sob1 where sob1.id=soa.id )
--]
from so_somain soa inner join so_sodetails sob on soa.id=sob.id
where soa.id not in (select id from ufida_so_order_amt_0)
--更新订单佣金百分比的问题,只有当百分比有填写的才更新,否则不更新
update so_somain set cdefine5=cdefine7*(select sum(inatsum) from so_sodetails b where a.id=b.id )/100
from so_somain a where cdefine7 is not null
这视图也有的。 ufida_so_order_amt_0
为什么数据库修复后就用不了了呢?各位大神帮帮忙。小弟感激不尽。。。谢谢!!!!
|
|