当前位置:Gxlcms > 数据库问题 > sqlever 对查询出来的数据进行遍历

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

时间:2021-07-01 10:21:17 帮助过:31人阅读

@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--记得删除零时表

 

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

标签:nbsp   rowid   code   real   col   eal   记录   row   行记录   

人气教程排行