Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Primary Keys when deleted can't be reused untill pack
Message
De
06/05/2000 22:19:06
 
 
À
06/05/2000 20:06:34
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00367026
Message ID:
00367046
Vues:
26
>How are developers handling the problem where a primary key and data record is added to a table. The user decides to start the record over so they delete the record. When they start to add the record again with the same key, they will get a duplicate key message because the key, although deleted, is still in the index, until I pack the file. One idea would be to change the key when I delete the record. Is there a better approach anyone is using.

Don't reuse the PK. By definition, a PK is unique for each record in the table. If you try to reuse one of a deleted record, you won't have unique values. Additionally, the PK is used for setting relations to other tables and maintaining referential integrity. Ideally, it should not be entered by the user. For a more complete discussion, see the KB article on my web site.
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform