Board index » delphi » Is there a problem using Autoincrement fields as a primary key

Is there a problem using Autoincrement fields as a primary key

Could anybody help me

I am developing a bde application where the database will be on a shared
drive on a network.

I heard that there are problems with the autoincrement fields.

should i use some other means to provide uniqueness for my tables.

any help would be appreciated.

Thanks

Michael Donovan
micha...@iol.ie

 

Re:Is there a problem using Autoincrement fields as a primary key


There is nothing inherently wrong with using autoinc fields, as long
as you don't use them to link one table to another.

The reason is that if you ever have to rebuild the table using
Tutility, autoinc fields will not retain their original numbering.

It's safer to use a one-record table to hold the last-used number.
When you insert a new record, open this table (with exclusive set to
true so no other user can open it at the same time), get the number,
increment it, update and close the table.

In article <01bd596f$59d4eb90$833e7dc2@defiant>, "Michael Donovan"

Quote
(micha...@iol.ie) writes:
>Could anybody help me

>I am developing a bde application where the database will be on a shared
>drive on a network.

>I heard that there are problems with the autoincrement fields.

>should i use some other means to provide uniqueness for my tables.

Re:Is there a problem using Autoincrement fields as a primary key


Hi,

Yes there is a problem with Ms access97 when you try to add a record, the
number you get for the field is bad.....

it works well if you do not use autoincr type; you must build your counter
to add 1 each time you add a record.....

i am intersted if you have others news...

good luck

JP Magne

icare...@worldnet.fr

Michael Donovan a crit dans le message
<01bd596f$59d4eb90$833e7dc2@defiant>...

Quote
>Could anybody help me

>I am developing a bde application where the database will be on a shared
>drive on a network.

>I heard that there are problems with the autoincrement fields.

>should i use some other means to provide uniqueness for my tables.

>any help would be appreciated.

>Thanks

>Michael Donovan
>micha...@iol.ie

Re:Is there a problem using Autoincrement fields as a primary key


If you want to stay out of trouble, avoid autoinc keys. It's a nighmare! I
can tell you!

Alain.

Quote
Michael Donovan wrote in message <01bd596f$59d4eb90$833e7dc2@defiant>...
>Could anybody help me

>I am developing a bde application where the database will be on a shared
>drive on a network.

>I heard that there are problems with the autoincrement fields.

>should i use some other means to provide uniqueness for my tables.

>any help would be appreciated.

>Thanks

>Michael Donovan
>micha...@iol.ie

Re:Is there a problem using Autoincrement fields as a primary key


Quote
Alain Brunet wrote:

> If you want to stay out of trouble, avoid autoinc keys. It's a nighmare! I
> can tell you!

This is true, if you are using the autoincrement field for example as
a consistent OrderNumber. The requirement often is, that no numbers may
miss from this kind of OrderNumber chain.  If your Db or indexes get
in some way corrupted, and to fix it you have to destroy some records
totally, then there is no easy tools to fix the values also in the
autoincrement field to keep the consistency.
  You can use autoincremented fields, and they work completely ok. But
it may be a good idea to let them stay on the background to keep your
Db records in order. Then add secondary index field that you use as
your consistent OrderNumber field.

I myself don't use autoincrement fields anywhere with Paradox tables.

Markku Nevalainen

Quote

> Michael Donovan wrote in message <01bd596f$59d4eb90$833e7dc2@defiant>...
> >Could anybody help me

> >I am developing a bde application where the database will be on a shared
> >drive on a network.

> >I heard that there are problems with the autoincrement fields.

> >should i use some other means to provide uniqueness for my tables.

> >any help would be appreciated.

> >Thanks

> >Michael Donovan
> >micha...@iol.ie

Other Threads