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
原文地址:http://www.cnblogs.com/duxingqishi/p/3716858.html