2

我在从灵巧性中调用 SQL 过程时遇到问题。该过程包含游标。假设此游标调用另一个调用 Dynamics GP 过程“taComputerChecklineinsert”的过程。工作应该是整个过程必须在工资单交易条目中插入交易。仅插入固定数量的 42 个事务。我有超过 42 笔交易。如果我使用相同的参数从 SQL 服务器执行相同的过程,它会给出所需的结果。当我灵巧地打电话时,问题就出现了。可能出了什么问题?...我已经研究了很长时间了....并且无法弄清楚问题所在。

4

1 回答 1

1

终于解决了。它与“taCreatePayrollBatchHeaderInsert”和“taComputerChecklineinsert”这两个 econnect 过程中的任何一个都无关。

由于 taCreatePayrollBatchHeaderInsert 在批量创建之前的选择语句而引发了该问题。select 语句用于为 taCreatePayrollBatchHeaderInsert 选择参数。

评论选择语句时,该代码非常好。

CREATE PROC [dbo].[GTG_PR_Create_ABS_Trx]  

  @CMPANYID   INT  
, @UPRBCHOR   INT   -- 1 = Computer Check , 2 = Manual Check        
, @BACHNUMB   CHAR(15)        
, @EMPLOYID   CHAR(15)        
, @COMPTRTP   SMALLINT -- Computer transaction type:1 = Pay code; 2 = Deduction; 3 = Benefit        
, @SALCHG   SMALLINT -- Salary change ; required if passing a salary pay code:1 = Reallocate dollars; 2 = Reallocate hours;3=Reduce dollars;4=Reduce hours;=5=Additional amount        
, @UPRTRXCD   CHAR(6)  -- (OT , ABS)        
, @TRXBEGDT   DATETIME        
, @TRXENDDT   DATETIME        
, @Amount   NUMERIC(19 , 5) -- Amount        
, @ProcessStatus  INT  OUT            
, @ErrorState  INT   OUT      
, @ErrString   VARCHAR(255) OUT      

AS        


set @ErrorState = 0    
set @ErrString  = ''    

 -- Create batch if it doesn`t exist        
 IF NOT EXISTS( SELECT 1 FROM DYNAMICS..UPR10304 WHERE BACHNUMB = @BACHNUMB AND CMPANYID = @CMPANYID AND UPRBCHOR = @UPRBCHOR )        

BEGIN        

 **--SELECT  @BACHNUMB      
 --    ,@UPRBCHOR      
 --    ,@ErrorState    
 --    ,@ErrString**     


   EXEC  taCreatePayrollBatchHeaderInsert        
       @I_vBACHNUMB =  @BACHNUMB        
     , @I_vUPRBCHOR =  @UPRBCHOR        
     , @O_iErrorState  =  @ErrorState  OUT        
     , @oErrString  =  @ErrString  OUT     

  -- Associate employee deduction code if association doesn`t exist        
  IF NOT EXISTS(SELECT 1 FROM UPR00500 WHERE EMPLOYID = @EMPLOYID AND DEDUCTON = @UPRTRXCD)        
   BEGIN        
    EXEC taCreateEmployeeDeduction        
     @I_vEMPLOYID  =  @EMPLOYID         
   , @I_vDEDUCTON  =  @UPRTRXCD        
   , @O_iErrorState =  @ErrorState  OUT        
   , @oErrString  =  @ErrString  OUT                    


   END        

  -- Create Transaction        

  EXEC taCreateComputerCheckLineInsert        

            @I_vBACHNUMB    = @BACHNUMB        
           , @I_vEMPLOYID   = @EMPLOYID        
           , @I_vCOMPTRTP   = @COMPTRTP        
           , @I_vSALCHG     = @SALCHG         
           , @I_vUPRTRXCD   = @UPRTRXCD        
           , @I_vTRXBEGDT   = @TRXBEGDT        
           , @I_vTRXENDDT   = @TRXENDDT        
           , @I_vVARDBAMT   = @Amount  
           , @O_iErrorState = @ErrorState OUT        
           , @oErrString    = @ErrString  OUT                    

END        


GO
于 2014-12-08T08:04:26.087 回答