Generate Number Range 2

,

Alternate method for generating a rowset with all of the numbers in a specified range.

set nocount on
create table #NumRange(
	n int
)

declare @Count int
declare @Min int
declare @Max int

set @Min = 1
set @Max = 24601
set @Count = @Min

while @Count<= @Max
begin
	insert into #NumRange
	values(@Count)

	set @Count= @Count+ 1
end
select n as num from #NumRange
drop table #NumRange

Rate

Share

Share

Rate