sqlsever while 循环


1
declare @start int 2 declare @end int 3 DECLARE @Tmp table( 4 yearNum varchar(50) --修改后 的 目标值 5 ); 6 7 select @start=startyear,@end=endYear from [Scenarios] 8 where scenarioid=@scenarioid 9 while @start<@end 10 begin 11 insert into @Tmp 12 select @start 13 set @start=@start+1 14 end 15 16 select * from @Tmp;

 

posted @ 2018-09-28 09:43  dotdotdog  阅读(134)  评论(0编辑  收藏  举报