Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Unique and incremental field in a table
Message
 
À
02/10/1997 18:37:24
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00052959
Message ID:
00052999
Vues:
41
>The title says it all! > >Is there anybody who have a code snippet for this? >Everytime a new record is appended to a table one numeric field is to be >incremented with 1. > >Hope there is help on this! > >Best regards >Per Simmersholm Hi, this things was often discussed here. You can check older messages for this. I use this function for that. It's in database's stored procedures, and as a default value for my field ID in table I have uniq_id(). That means every time I append record this function is trigerred and returns only valid unique ID number. I have table UNIQ_ID, where is only one record and couple fields, that every field represent one table. And value means next available ID number. function uniq_id if !used ('uniq_id') use main_dbc!uniq_id in 0 endif sele uniq_id local llLock local llRetVal llLock = .f. do while !llLock if rlock() llLock = .t. llRetVal = uniq_id.table1_id replace table1_id with table1_id + 1 unlock endif enddo return llRetVal hth Dezider --
There were three worst disasters in the history of human
race in 20-th century:
1, Hiroshima 44
2, Tchernobyl 86
3, Windows 95
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform