We will write very simple query. Do not worry about how will I write without loop.
Query
- ; with CTE as
- (
- select 1 Number
- union all
- select Number +1 from CTE where Number<100
- )
-
- select *from CTE
Output
.................
Explanation
Increment of number in a variable will always be 1, while loop iterates 100 times and print the numbers easily.