Have you run the correct one? See comment 26376582. Here it goes again.
1: 2: 3: 4: 5: 6: 7: 8:
;with CTE as ( select '000000' as num union all select right('000000' + cast((cast(num as int) + 1) as varchar),6) from CTE where num < 999999 ) select * from CTE option (maxrecursion 0);