PDA

View Full Version : Is it mandatory primary key should be Autonumber?



aligahk06
04-30-2010, 12:27 AM
Dear All,

Is it mandatory to primary key should be Autonumber?
Any help?

Imdabaum
04-30-2010, 07:35 AM
No. Lots of people use concatenated strings as the PrimaryKeys

Example:
TableCompanies
CompanyID = "companyname" & "something else"

CreganTur
04-30-2010, 09:29 AM
Any field that contains unique values that should not be repeated in your table could be the primary key. For instance an Account Number field could be your primary key if you know it should never repeat.

You can also create complex primary keys where you select multiple fields in your table (using Ctrl + click) and then click the primary key button. For instance you could create a complex PK of Account Number, Date and Last Name. This means you could have multiple combinations of data for those three fields but you could not have records that exactly duplicate all three together.

The type of PK you choose depends on the data you're working with and what you're trying to accomplish.