Last active
September 2, 2019 05:59
-
-
Save binki/9b7985c8832e1545d61cafaa669e3c28 to your computer and use it in GitHub Desktop.
Counting to 100 with recursive CTEs in SQL Server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH number AS (SELECT | |
CAST(1 AS BIGINT) Value | |
UNION ALL SELECT | |
n.Value + 1 | |
FROM number n | |
WHERE n.Value < 100) | |
SELECT n.Value | |
FROM number n | |
ORDER BY n.Value | |
; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment