Groups | Blog | Home
all groups > sql server new users > october 2007 >

sql server new users : create table and specify numbers in ID field



PolarBear
10/23/2007 9:42:00 AM
I need to create a table and generate numbers for the ID field ranging from
100001 thru 300000. In the next column, I will generate random numbers. the
resulting table will then serve as a key for mapping purposes.

I am OK on the random number aspect - however, what script is required to
generate the ID numbers?

Regards,

Andrew J. Kelly
10/23/2007 12:43:41 PM
The simplest way is to create the table with a column that has an IDENTITY
property in the range you require. See IDENTITY in BooksOnLine for more
details.

--
Andrew J. Kelly SQL MVP
Solid Quality Mentors


[quoted text, click to view]
PolarBear
10/23/2007 1:25:02 PM
Thanks Andrew. I have a Sybase SQL book and I found the information you
mentioned regarding Identity. This answeres my question.

Thank You

PolarBear
[quoted text, click to view]
AddThis Social Bookmark Button