A while back I wrote on Generating a million sequential numbers on the fly in a Firebird query – some solutions and speed measurements.
SQL Server has different features and performance characteristics so here are some links on doing similar things in SQL Server:
- [WayBack] sql server – SQL, Auxiliary table of numbers – Stack Overflow
- [WayBack] sql server – What is the best way to create and populate a numbers table? – Stack Overflow
As always: if performance is important, measure before starting to optimise!
Via: [WayBack] sql – All hour of day – Stack Overflow
–jeroen