M
Mark
Is there a rule on when to use a number as a primary key and when to use a
text field? At the moment I just decide if the primary key is too large and
is needed for foreign keys I use a number. For example, if I was to design
a table containing Transaction Types, I would create the Primary Key
(TransactionTypeID) as dr (debit) and cr (credit). Similarly if I was to
create a Unit Of Measure table my primary key would be the abbreviation of
the Unit e.g. EA, KG etc. When creating a users table in which all users
have a login username, I assign the primary key as UserID and not their
username even though they all have one and they are all unique. For a
products table if a Product Code is 5 digits long and is one for each
product and doesn't change, should this be the primary key or should I
assign an autonumber?
Thanks in advance
text field? At the moment I just decide if the primary key is too large and
is needed for foreign keys I use a number. For example, if I was to design
a table containing Transaction Types, I would create the Primary Key
(TransactionTypeID) as dr (debit) and cr (credit). Similarly if I was to
create a Unit Of Measure table my primary key would be the abbreviation of
the Unit e.g. EA, KG etc. When creating a users table in which all users
have a login username, I assign the primary key as UserID and not their
username even though they all have one and they are all unique. For a
products table if a Product Code is 5 digits long and is one for each
product and doesn't change, should this be the primary key or should I
assign an autonumber?
Thanks in advance