Re: problem using identity column as primary key
From: Jacco Schalkwijk (NOSPAMjaccos_at_eurostop.co.uk)
Date: 02/24/04
- Next message: Bob Boran: "Re: Need help with SELECT Query"
- Previous message: Bob Boran: "Re: Need help with SELECT Query"
- In reply to: Nikhil Patel: "problem using identity column as primary key"
- Next in thread: Louis Davidson: "Re: problem using identity column as primary key"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 24 Feb 2004 15:53:31 -0000
Hi Nikhil,
If you want something that doesn't leave holes in the sequence, don't use
IDENTITY. To put it more strongly, you shouldn't attach any meaning to the
values in an identity column, it just is an automatically generated value.
It isn't even guaranteed to be unique on it's own (because you can reset it
with a different start value).
You don't have to worry about the number of values in an identity column.
Using an int will give you more than 2 billion rows, and that will last
quite a while.
-- Jacco Schalkwijk SQL Server MVP "Nikhil Patel" <nikhil0100@aol.com> wrote in message news:e6OJGxu%23DHA.712@tk2msftngp13.phx.gbl... > Hi, > I am thinking of creating an identity column to use it as primary key in > my table. But the problem is that once I delete some records, the SQL Server > would not reuse the IDs of the deleted records. So there will be holes in > the sequence. I know many people use Identity columns to generate unique id. > How do they deal with the holes in the identity columns? Do I need to worry > about the size of the identity column or whether or not the column would run > out of IDs or any other problem? > > thanks... > -Nikhil > >
- Next message: Bob Boran: "Re: Need help with SELECT Query"
- Previous message: Bob Boran: "Re: Need help with SELECT Query"
- In reply to: Nikhil Patel: "problem using identity column as primary key"
- Next in thread: Louis Davidson: "Re: problem using identity column as primary key"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|