declare @i int set @i=1 while @i<30 begin insert into test (userid) values(@i) set @i=@i+1 end
来源:http://www.cnitblog.com/malan11/articles/31153.html