Page 1 of 1

Primary key Identificator on a table

Posted: Wed Aug 28, 2002 10:59 am
by AVATAr
Just a question of the primary key in a table,... what do you thik is best, use an autoincrement field or a timestamp?

Thanks

Posted: Wed Aug 28, 2002 12:47 pm
by mikeq
I would go with the autoincrement.

There is a very slim chance (very very slim) that 2 people may retrieve the same timestamp, dependent on when it is assigned.

A primary key can be anything, as long as it is unique.

thxs

Posted: Wed Aug 28, 2002 12:52 pm
by AVATAr
i knew about that chance... but i thought that if i have to store the timestamp anyway... i could use it as primary key.

Posted: Wed Aug 28, 2002 1:41 pm
by JPlush76
definately autoincrement

if you have a timestamp field as your first record in the table it will be updated EVERYTIME that row is accessed, so your key would always be changing

great

Posted: Wed Aug 28, 2002 1:43 pm
by AVATAr
good point ... but... if i insert a timestamp in a string field... or some...

however.. i see autoincrement is the best solution

thanks