C
chenp1688
Unregistered / Unconfirmed
GUEST, unregistred user!
create proc [PO_CHInitsh] ASGO SET NOCOUNT ON --不返回影响行数信息,以减少网络流量 SET XACT_ABORT ON --打开自动回滚begin --把数据插入库存表 insert into CH_FItemRecord (FItemID,Fnumber,FBegQty,FBegPrice,FBatchNo,Fstock,FunitID) select FItemID,Fnumber,sum(fqty)as fqty, sum(fcprice)as fcprice,fbatchno, Fstock,funitid from CH_FItemInitial where (fqty is not null) and (fcprice is not null ) group by FItemID,Fnumber,fbatchno,Fstock ,funitid order by Fnumber --修改库存表的启用时间初始数据的期间等于启用期间 update CH_FItemRecord set Fcyear=(select StartYear from CH_System) ,Fcperiod=(select StartPeriod from CH_System) where FItemID is not null --把数据插入到即时库存表 insert into CH_FItemGSKC( FItemID,Fnumber,FJSkcQty,FBatchNo,Fstock,FunitID) select FItemID,Fnumber,sum(fqty)as fqty, fbatchno, Fstock,funitid from CH_FItemInitial where (fqty is not null) and (fcprice is not null ) group by FItemID,Fnumber,fbatchno,Fstock ,funitid order by Fnumber --修改系统参数表 update CH_System set IsForbidCSH=1 SET XACT_ABORT OFF --打开自动回滚endGO问题一,存储过程在创建的时时候已经把相关数据按照要求处理了.问题二,exec PO_CHInitsh 再执行存储过程没有反应.(也就是没有把数据插入表里)请教是哪里写错了,谢谢能给予指正