Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Primary Keys when deleted can't be reused untill pack
Message
 
À
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:
00367029
Vues:
28
>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.

Does the user need to see the primary key? If not, hide it from them and you won't need to worry if there are gaps in the keys. Generate the keys yourself behind the scenes. It is not good practice to have the user generate the primary keys.

If you are stuck with the situation as described above then you may want to mark the record as deleted and then the next time someone wants to add a new record, reuse one of the deleted records and blank out everything except the primary key.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform