--定义参数 declare @Row_LevelIndex int declare @Row_UserID int declare @Row_MemberRight int declare @Row_CaptainID int declare @Row_Score decimal(18,2) declare @Row_GroupID int declare @Row_ScoreCount decimal(18,2) declare @Row_DrawCount int declare @Row_AwardScore decimal(18,2) --定义游标 declare data_temp cursor for select * from @TEMS_Table where LevelIndex =2 and MemberRight=4 --数据源 ,* 所代表字段(Index,UserID,MRight,CapID,Score,GId,Count,Draw,Award)与上面定义参数对应 open data_temp fetch next from data_temp into @Row_LevelIndex,@Row_UserID,@Row_MemberRight,@Row_CaptainID,@Row_Score ,@Row_GroupID,@Row_DrawCount,@Row_AwardScore --读取第一行 while (@@fetch_status = 0) --如果还有记录(行) begin --写逻辑 eg: IF(@Row_LevelIndex>0) BEGIN --........ END fetch next from data_temp into @Row_LevelIndex,@Row_UserID,@Row_MemberRight,@Row_CaptainID,@Row_Score ,@Row_GroupID,@Row_DrawCount,@Row_AwardScore --读取下一行 end close data_temp deallocate data_temp
标签:temp,--,游标,SERVER,int,SQL,data,declare,Row From: https://www.cnblogs.com/valeb/p/18087003