Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Way to create unique ID
Message
From
20/01/2003 19:02:32
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
20/01/2003 18:55:29
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00743532
Message ID:
00743611
Views:
16
>Hi Nadya,
>
>If you truly need uniqueness spanning multiple tables, look at using a GUID. I think Rick Strahl has some GUID API code on his website and they might have some here as well.

My article on primary keys (http://www.utmag.com/May2002/Page14.asp) lists the functions for creating a GUID.

Note that a GUID is fairly big for a PK - 16 bytes. A shorter PK, useful for disconnected sites, might be to assign each site a unique number, and then use something like bintoc(site, 2) + bintoc(SerialNumber("TableName")), where SerialNumber uses the usual approach of saving the sequences in a table. This makes a total of 6 bytes (if more than 65,000 sites are required, 8 bytes).

I must add that I never tried this in practice, though.

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform