--DECLARE @Min int;
--DECLARE @Max int;
--SET @Max = 10;
--SET @Min = 1;
--WITH Sequence_ AS(SELECT @Min AS num UNION ALL SELECT num + 1 FROM Sequence_ WHERE num + 1 <= @Max)
--SELECT num FROM Sequence_
--DECLARE @Min int;
--DECLARE @Max int;
--SET @Max = 110;
--SET @Min = 1;
--WITH Sequence_ AS(SELECT @Min AS num UNION ALL SELECT num + 1 FROM Sequence_ WHERE num + 1 <= @Max)
--SELECT num FROM Sequence_
DECLARE @Min int;
DECLARE @Max int;
SET @Max = 150;
SET @Min = 1;
WITH Sequence_ AS(SELECT @Min AS num UNION ALL SELECT num + 1 FROM Sequence_ WHERE num + 1 <= @Max)
SELECT num FROM Sequence_
OPTION(MAXRECURSION 32767)
--OPTION(MAXRECURSION 32768)
--OPTION(MAXRECURSION 0)
No comments:
Post a Comment