• For a limited number of rows (< 100) using a recursive common table expression is an alternative:

    DECLARE @lowerbound int

    DECLARE @increment int

    DECLARE @upperbound int

    SET @lowerbound = -5

    SET @upperbound = 90

    SET @increment = 3

    ;

    WITH seq AS (

    SELECT @lowerbound AS n

    UNION ALL

    SELECT seq.n + @increment AS n

    FROM seq INNER JOIN (SELECT NULL AS a) a ON

    n < @upperbound

    )

    SELECT n FROM seq

    Note that due to recursion, the number of returned rows may not exceed 99.

    Jan-Willem Lankhaar