Ajit Abraham wrote:
> Hi Dave,
>
> I found it easier generating the primary keys at the frontend rather 
> than asking the backend to generate it (autoinc or @@)
>
> I use the technique suggested in
> "FoxPro 2.5 Advanced Developer's Handbook"
> *by Adams and Powell, Chapter 18, page 644.
> FUNCTION ukey
> PARAMETER lenkey
> LOCAL len1,len2,key1,key2
> IF PARAMETERS()=0
>      lenkey=8
> ENDIF
> len1=FLOOR(lenkey/2)
> len2=lenkey-len1
> key1= RIGHT(SYS(3),len1)
> key2= RIGHT(SYS(2015),len2)
> RETURN key1+key2
>
> This logic should be ok for small databases. But may not be sufficent 
> for really huge ones. Maybe adding a GUID with the above logic for a 
> "more" unique primary key.
>
>   

How does that do for multiple users hitting the database with 
adds/updates at the same time?


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to