S
seeme0526
Unregistered / Unconfirmed
GUEST, unregistred user!
有这样一个存储过程,通过触发器运行它时就死了。没有商量……200分起
CREATE PROCEDURE spdata AS
Delete From gcweb
Select wzbm,Sum(shsl-fhsl) As kcsl
Into #Sumgc
From gcszc
Group By wzbm
Insert Into gcweb
(wzbm,wzmc,ggxh,shsl,fhsl,kcsl)
Select A.wzbm,A.wzmc,A.ggxh,A.shsl,A.fhsl,B.kcsl
From gcszc A,#Sumgc B
Where A.wzbm=B.wzbm and A.jldate=(Select Max(jldate) From gcszc)
Select wzbm,wzmc,ggxh,shsl,fhsl,kcsl
From gcweb
Order By wzmc,ggxh
CREATE PROCEDURE spdata AS
Delete From gcweb
Select wzbm,Sum(shsl-fhsl) As kcsl
Into #Sumgc
From gcszc
Group By wzbm
Insert Into gcweb
(wzbm,wzmc,ggxh,shsl,fhsl,kcsl)
Select A.wzbm,A.wzmc,A.ggxh,A.shsl,A.fhsl,B.kcsl
From gcszc A,#Sumgc B
Where A.wzbm=B.wzbm and A.jldate=(Select Max(jldate) From gcszc)
Select wzbm,wzmc,ggxh,shsl,fhsl,kcsl
From gcweb
Order By wzmc,ggxh