Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Thought I'd Run This One by Everybody First.....
Message
De
27/07/2000 09:37:30
 
 
À
27/07/2000 08:55:06
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00397485
Message ID:
00397547
Vues:
10
Additionally,

I have a function I call to get me a new key.
**Generates a unique number based on date and time and to use as a Primary Key
**Returns a Number: Should always be a ten digit number
FUNCTION GetKey
LOCAL cdatetime
CdateTime=str(recno())+str(seconds())+str(ROUND(RAND()*1000000000,0))
CdateTime=strtran(cdatetime,' ','')
nkey=ROUND(val(substr(CdateTime,1,10)),10)
RETURN nkey

If it's an insert I call this function and generate a key. Other wise I use the key in the where clause as Marfk stated.

It's faster than using Oracle Sequences and I use the same code for FoxPro;oracle SQL Server.
Instead of Identity columns and sequences. This gives me a new key.

Just thought I'd share that with you.

I have never ever had a duplicate key generated.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform