• This is a sidebar but....

    I am struggling with how the CTE is referencing itself from within itself

    This works but I need clarification on it. The CTE is referencing itself from within itself.

    I did not realize this was possible.

    Any clarification would be greatly appreciated.

    ;WITH mycte AS

    (SELECT 100 AS seedValue

    UNION ALL

    SELECT seedValue + 1 FROM mycte WHERE seedValue + 1 < 200

    )

    select * from mycte