If you do not currently have a numbers table setup in your database (which you should - they're invaluable), you quickly and easily generate a large list of sequential values using some crafty SQL statements and an internal SQL Server table. I'll be using the undocumented spt_values table in the master database. This table holds a potpourri of different database values that can be used for different reasons...and it also holds a small series of sequential numbers. I can use these sequential...
Filed under: JOIN, SQL Server, criteria, system table, cartesian product, query, numbers table, where clause, sequential, master, values, iteration, cross join, database, records, row_number