Board index » delphi » KEY VIOLATION on AUTOINCREMENT field ?!?

KEY VIOLATION on AUTOINCREMENT field ?!?

I have several pdox7.0 tables with autoincrement fileds as their primary
keys.
The tables are used from 4 computers (LOCAL SHARE=TRUE on server).
Still, almost every day I have KEY VIOLATION problems.

The only way I solve it is by changing field type from AUTOINCREMENT to
INTEGER, pack the table, then back to AUTOINCREMENT and pack again,
and wait for next KEY VIOLATION to occur.

Please HELP!

P.S.  Apart from AUTOINCREMENT fields there are no other unique columns in
any table.

 

Re:KEY VIOLATION on AUTOINCREMENT field ?!?


Sounds like 2 or more machines are creating a record at the same time thus
be assigned the same autoincremented number. You might need to create a
function in your code to handle this instead of leaving it up to the paradox
tables.

Change the field to an integer and assign the number yourself.

Quote
Mirko Vucicevic wrote in message <772d0s$ig...@zevs.beotel.net>...
>I have several pdox7.0 tables with autoincrement fileds as their primary
>keys.
>The tables are used from 4 computers (LOCAL SHARE=TRUE on server).
>Still, almost every day I have KEY VIOLATION problems.

>The only way I solve it is by changing field type from AUTOINCREMENT to
>INTEGER, pack the table, then back to AUTOINCREMENT and pack again,
>and wait for next KEY VIOLATION to occur.

>Please HELP!

>P.S.  Apart from AUTOINCREMENT fields there are no other unique columns in
>any table.

Other Threads