Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need help with a primary key
Message
De
08/06/2001 14:28:38
David Fluker
NGIT - Centers For Disease Control
Decatur, Georgie, États-Unis
 
 
À
08/06/2001 13:45:26
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00517080
Message ID:
00517107
Vues:
22
>Does anybody know of a way to automatically increment your primary key in a table being created in Visual FoxPro?
>
>My goal is to have my user "skip" the field automatically. A new number would be added to the field each time they entered new records in my other fields.
>
>Thanks,
>
>John York

John,

If you want a unique, primary key, and don't need an incremented, numeric key, you can use SYS(2015) for the default value. It is faster than using a table to maintain an incremental key, and won't generate duplicates if the NextID table ever gets messed up. There is a very tiny possibility that multiple users can generate a duplicate key if they both call the function at the exact same millesecond.

If you don't like the underscore for the first character, you can use SUBSTR(SYS(2015),2)
David.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform