日期:2014-05-17  浏览次数:20390 次

游标换成循环,,,谢谢
  declare Level1 cursor for                                                  
  select companyid,dptid,dptname,capcode,oldcode,storplace_id,storplace,deptype,years,months,buydate,usedate,chief,chiefcode,examiner,paymethod,                                                  
         rowid,Capcode,Capname,round(orivalue/qty,2)  as price, qty,round(depvalue/qty,2) as depvalue,round(salvalue/qty,2) as salvalue,orivalue,depvalue,memo,usetype,        
         usercode,username                                  
  from VfCapdocA with (nolock)                                                  
  where doccode=@doccode                                
                                  
                                  
  select @CardNo=0                      
                                                    
  open Level1       
                                             
  fetch next from Level1 into @companyid,@dptid,@dptname,@capcode,@oldcode,@storplace_id,@storplace,@deptype,@years,@months,@buydate,@docdate,@chief,@chiefcode,@examiner,