I have two numbers as input from the user, like for example 1000 and 1050.
1000
1050
How do I generate the numbers between these two numbers, using
an alternative solution is recursive CTE:
DECLARE @startnum INT=1000 DECLARE @endnum INT=1050 ; WITH gen AS ( SELECT @startnum AS num UNION ALL SELECT num+1 FROM gen WHERE num+1<=@endnum ) SELECT * FROM gen option (maxrecursion 10000)