每次查询表中的一条数据,遍历整个表

时间:2014-05-09 09:58:20   收藏:0   阅读:261

declare @a int
select @a=20
--COUNT(*) from SEC_SecureUser
while(@a>0)
begin
select top 1 suUserID,SUID from SEC_SecureUser where SUID not in(select top (@a-1) SUID from SEC_SecureUser order by SUID asc) order by SUID asc
set @a=@a-1;
end

每次查询表中的一条数据,遍历整个表,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!