Posted by Plamen Ratchev on 09/30/13 12:01
Here is a method using the system table spt_values
(http://www.sqlmag.com/Articles/ArticleID/22920/pg/2/2.html), which works
fine for small numbers table (note: the table is undocumented and assuming
unsupported). This works fine on SQL Server 2000, 2005, and the current 2008
CTP:
CREATE TABLE Numbers (nbr INT NOT NULL PRIMARY KEY)
INSERT INTO Numbers ( nbr )
SELECT number FROM master..spt_values
WHERE type = 'P'
AND number BETWEEN 1 AND 100
HTH,
Plamen Ratchev
http://www.SQLStudio.com
[Back to original message]
|