RE: Autonumbering Primary Keys

From: BruceM (BruceM_at_discussions.microsoft.com)
Date: 03/17/05


Date: Thu, 17 Mar 2005 04:59:02 -0800

This is an ongoing debate. I personally use autonumbers in most cases, even
if I don't see an immediate use for them. It's what I learned, and what I am
accustomed to using. People have maintained that by creating an unneeded
index (or something like that), it slows down performance, but I'm not
convinced that a combined PK is an improvement in that regard. I have heard
of instances where a company changed the format of an EmployeeID number or
some other number (by appending a 0, for instance, to allow for more IDs than
the current system allowed). Had EmployeeID been used as the primary key, or
as part of a combined PK, it could have been pretty messy.
Having said that, Order Number can serve as a PK if you like, since it will
be unique no matter if it is 1 digit or 10. You may want to look into an
incremented order number, in which 1 (or whatever you want) is added to the
number from the previous record. Try a groups search for "increment number
primary key" or "increment autonumber" or "simulated autonumber" or something
of the sort.
Use what works best for you. There is no single correct answer for every
situation.

"CC" wrote:

> Hi! I'm doing an orders database. For the primary key, I was going to use the
> order numbers since those will always be unique. However, it seems that
> Access suggests that I have a separate column for OrderID using Autonumbers.
>
> Is there a reason I should always have a separate ID column as the primary
> key? Should I not use Order numbers or part numbers as primary keys?



Relevant Pages

  • Re: FAQ? factors influencing choice of data type for primary key
    ... In the past, I tended to use AutoNumbers in all tables, for consistency. ... For example, in a current project, a table 'tblAccident' is ... FROM tblAccidentStatus INNER JOIN (tblAccidentLevel INNER JOIN ... The primary key of tblAccident itself is still an AutoNumber, however, as ...
    (microsoft.public.access.tablesdbdesign)
  • Re: null but not null
    ... I agree with you on the use of autonumbers. ... they prefer to use meaningful Unique data. ... primary key. ... we are properly normalized and the [SuperVisor] field is an FK to ...
    (microsoft.public.access.forms)
  • Re: automatic consecutive numbering
    ... Keep in mind that the Primary Key can consist of more than ... >I will go to your website and study your example. ... >> Autonumbers should never be used for anything other ... >> assigned to equipment located in my facility. ...
    (microsoft.public.access.gettingstarted)
  • Re: AutoNumber Question
    ... Autonumbers in Access are intended as unique row identifiers, ... using the primary key from table1 ... your table2 relationship! ...
    (microsoft.public.access.tablesdbdesign)
  • Re: autonumber
    ... If you need to work with autonumbers, then check next links how to do this properly. ... There is no reason to create variables to increment this value and it is not reliable way. ... Dim toadd As String ...
    (microsoft.public.vb.database.ado)