Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
AutoIncrement Field and Duplicating Records
Message
From
03/08/2007 16:15:26
 
 
To
03/08/2007 14:11:43
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01245869
Message ID:
01245897
Views:
24
>Another developer (currently on vacation) created a field (Claim) as an autoincrementing integer, to act as a primary key (the index itself is just a Regular, not Candidate). But now we are getting bad data, and the field values seemed to work okay for the first 25000 or so - and then reset to 1. So now there are are hundreds of bad records. So the last 800-odd records have duplicated claim numbers. The immediate question is, whether there is any way programmatically to determine what the next autoinc value is, and then how to reset it. The other question is how it got screwed up, and what to do to prevent it.

Just don't use autoinc - then you don't care <g>. Quite a few colleagues of mine have been bitten by now by some way or another by autoinc. But for future less troubled times:

a) candidate keys will at least stop errors from building up inside your tables
b) a simple but very helpful thing in troubled times is the existance of DIFFERENT TS fields tCreate, tChange, tDelete.
c) if the data IS important/expensive: log all entries/changes. Save every day the log for the last 3 days. Gives you a way "to play" back and a bit of fault redundancy through the 3 days overlap.

Usually b) and c) can be implemented with minimal HW cost - hope your app falls into the range where this approach is possible.

HTH

thomas
Previous
Reply
Map
View

Click here to load this message in the networking platform