Created
April 8, 2014 07:20
-
-
Save sqlparser/10099189 to your computer and use it in GitHub Desktop.
common table expression
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 mycte(x) AS (SELECT x = Convert( VARCHAR(1000), 'hello' ) | |
UNION ALL | |
SELECT Convert( VARCHAR(1000), x + 'a' ) | |
FROM mycte | |
WHERE Len( x ) < 10 | |
UNION ALL | |
SELECT Convert( VARCHAR(1000), x + 'b' ) | |
FROM mycte | |
WHERE Len( x ) < 10) | |
SELECT x | |
FROM mycte | |
ORDER BY Len( x ), | |
x; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment