存储过程游标及WHILE语句
Declare Write_Cursor Cursor For Select a.AuditingID, a.BillType, a.AuditingDescription, a.AuditingStep, a.EtypeID, b.FullName, a.AuditingAlerm From AuditingFlowDetail a,Employee b Where a.AuditingID = @nAuditingID And a.AuditingStep = @CurStep And a.EtypeID = b.TypeID AND outKty=@IfOut Open Write_Cursor Fetch Next From Write_Cursor Into @AuditingID, @BillType, @AudDesc, @AuditingStep, @ETypeID, @EName, @AuditingAlerm IF @IfOut='i' AND @OutLever<>1 BEGIN Insert #AudDetail ([AudID],[BillType],[Desc],[Step],[EtypeID],[Name],[AuditingAlerm]) Values (@AuditingID, @BillType, @AudDesc, @AuditingStep-