If you need a CTE, here is an example:
Initial insertion:
insert into rangeTable (StartValue, RangeValue)
select 40,100
union all select 150,10
go
request:
with r_CTE (startVal, rangeVal, generatedVal)
as
(
select r.startValue, r.rangeValue, r.startValue
from rangeTable r
union all
select r.startValue, r.rangeValue, generatedVal+1
from rangeTable r
inner join r_CTE rc
on r.startValue = rc.startVal
and r.rangeValue = rc.rangeVal
and r.startValue + r.rangeValue > rc.generatedVal + 1
)
select * from r_CTE
order by startVal, rangeVal, generatedVal
, 100. 32767,
option (maxrecursion 32767)
option (maxrecursion 0)
. BOL