create table test1(ID int,UserName nvarchar(10))
select * from test1insert test1 values (1,'11')insert test1 values (2,'22')insert test1 values (3,'33')insert test1 values (4,'44')insert test1 values (5,'55')declare @id int
declare @username varchar(20)select @id=min(ID) from test1while @id is not nullbegin select @username= UserName from test1 where print @username select @id=min(ID) from test1 where ID>@idend