You are here: Re: multiple numbers in one statement « MsSQL Server « IT news, forums, messages
Re: multiple numbers in one statement

Posted by Plamen Ratchev on 09/29/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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация