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;