Primary Key Limitation (1 Viewer)

SarahO

Registered User.
Local time
Today, 08:33
Joined
Feb 2, 2006
Messages
13
I wonder if anyone can help me. I have a table in my database which currently uses 9 fields to make up the primary key. I wanted to add a further 2 fields to this to make 11, however Access will only accept 10. Does anyone know any way around this please?
 

neileg

AWF VIP
Local time
Today, 16:33
Joined
Dec 4, 2002
Messages
5,975
Why on earth would you want such a complex PK? In any event, you can't have more than 10 fields in either a PK or a multi-field index.
 

SarahO

Registered User.
Local time
Today, 08:33
Joined
Feb 2, 2006
Messages
13
I built the DB originally, however had it sent away for normalisation and then the 2 databases were reconciled. The database is to schedule jobs required and many of the jobs contain very similar information hence the requirement for a large PK. I assume I will have to try and work out a different PK that uses 10 fields or less.
Thanks
 

neileg

AWF VIP
Local time
Today, 16:33
Joined
Dec 4, 2002
Messages
5,975
Why don't you just use an autonumber as a PK?
 

dsigner

Registered User.
Local time
Today, 16:33
Joined
Jun 9, 2006
Messages
68
Go back to single PK before it or you falls over. If you cannot add an autonumber PK to the jobs table then use a full date and time as PK. It is very unlikely that two jobs will be created to the second and if you make it unique the second job will have to be later to be accepted.
 

SarahO

Registered User.
Local time
Today, 08:33
Joined
Feb 2, 2006
Messages
13
Thanks I will try both ideas. The database uses an excel macro to add some of the jobs where as others are added manually via forms. The excel macro may mean that several jobs are added at once. I'll have a go anyway.
Cheers
Sarah
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 10:33
Joined
Feb 28, 2001
Messages
27,322
I vote for an autonumber PK and let your other 9 fields be ordinary indexes, of which you can have several.

If you have constraints involving parts of your key set, make the constraining parts a compound key that must be unique. Like, USERNAME + SUBMISSIONTIME + QUEUENAME as a compound index.

You should be aware that the more keys you have as a member of a PK, the less useful the PK gets in making things work smoothly.

Also, the concept of relational databases implies that you would use shorter keys as PKs because otherwise the data in common between parent and child would be wasteful.
 

Users who are viewing this thread

Top Bottom