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
This will also do
DECLARE @startNum INT = 1000; DECLARE @endNum INT = 1050; INSERT INTO dbo.Numbers ( Num ) SELECT CASE WHEN MAX(Num) IS NULL THEN @startNum ELSE MAX(Num) + 1 END AS Num FROM dbo.Numbers GO 51