sqlever 对查询出来的数据进行遍历

Declare   @row int,  --行记录数
@count int,--总记录数
@id int, --你需要的结果select @count=COUNT(1),@row =1 from  表名
 SELECT ROW_NUMBER() OVER (ORDER BY UserId ASC) rowid,* into #t from 表名while @row <= @count --循环开始 
BEGIN
select @id=rowid,@TopRealTimeXml=TopRealTimeXml,@userId=UserId from #t where rowid=@row --当前列的数据
--需要执行的代码 set @row=@row +1
END
drop table #t--记得删除零时表

 

posted @ 2020-05-28 12:22  七分暖  阅读(421)  评论(0编辑  收藏  举报
回到顶部