declare @i int set @i = 1 while @i < 30 begin insert into test (userid) values(@i) set @i = @i + 1 end