Created
February 20, 2016 23:08
-
-
Save emersion/d05da8d1b704a8ffccae to your computer and use it in GitHub Desktop.
PrintOddNumbersVerifiedByMicrosoftSQLServer2012.sql
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
| DECLARE @start INT = 1; | |
| DECLARE @end INT = 100; | |
| WITH numbers AS ( | |
| SELECT @start AS number | |
| UNION ALL | |
| SELECT number + 1 | |
| FROM numbers | |
| WHERE number < @end | |
| ) | |
| SELECT * | |
| FROM numbers | |
| WHERE number % 2 <> 0 | |
| OPTION (MAXRECURSION 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment