I
itassist06
Unregistered / Unconfirmed
GUEST, unregistred user!
Create Procedure CalQcPassNum1 @PartFM varchar(18),@PartTO varchar(18)
AS
Declare @PurBBID varchar(50)
Declare @QcPassNum numeric(11,2)
Declare @SpareNum numeric(11,2)
begin tran
Update PurB Set PurB.QcPassNum_=0 from PurB B inner join PurH H on B.PID_=H.ID_ Where B.PartCode_ between @PartFM and @PartTO and H.Final_=1 and B.Finish_=0
Declare QcCursor cursor for Select PurBBID_,QCPassNum_,SpareNum_ from Receive Where PartCode_ between @PartFM and @PartTO and AFinal_=1
open QcCursor
fetch next from QcCursor into @PurBBID,@QcPassNum,@SpareNum
while @@fetch_status=0
begin
Update PurB Set PurB.QcPassNum_=PurB.QcPassNum_+ @QcPassNum+Case When PurB.SpareNum_- @SpareNum <0 then @SpareNum else PurB.SpareNum_ end Where ID_=@PurBBID
fetch next from QcCursor into @PurBBID,@QcPassNum,@SpareNum
end
Close QcCursor
deallocate QcCursor
commit tran
GO
假如我现在要用delphi调用上面这个存储过程代码需怎样写,
我是初学者,请高手们写的详细一些,最好有说明.
AS
Declare @PurBBID varchar(50)
Declare @QcPassNum numeric(11,2)
Declare @SpareNum numeric(11,2)
begin tran
Update PurB Set PurB.QcPassNum_=0 from PurB B inner join PurH H on B.PID_=H.ID_ Where B.PartCode_ between @PartFM and @PartTO and H.Final_=1 and B.Finish_=0
Declare QcCursor cursor for Select PurBBID_,QCPassNum_,SpareNum_ from Receive Where PartCode_ between @PartFM and @PartTO and AFinal_=1
open QcCursor
fetch next from QcCursor into @PurBBID,@QcPassNum,@SpareNum
while @@fetch_status=0
begin
Update PurB Set PurB.QcPassNum_=PurB.QcPassNum_+ @QcPassNum+Case When PurB.SpareNum_- @SpareNum <0 then @SpareNum else PurB.SpareNum_ end Where ID_=@PurBBID
fetch next from QcCursor into @PurBBID,@QcPassNum,@SpareNum
end
Close QcCursor
deallocate QcCursor
commit tran
GO
假如我现在要用delphi调用上面这个存储过程代码需怎样写,
我是初学者,请高手们写的详细一些,最好有说明.