04 July 2014

Get continuous sequence numbers in sql sever

with d as
(
select 1 as a
union all
select a+1 from d where a<10
)
select * from d --option (maxrecursion 0)

Output:
a
1
2
3
4
5
6
7
8
9
10

No comments: