Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Thought I'd Run This One by Everybody First.....
Message
From
27/07/2000 09:37:30
 
 
To
27/07/2000 08:55:06
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00397485
Message ID:
00397547
Views:
9
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.
Previous
Reply
Map
View

Click here to load this message in the networking platform