Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Way to create unique ID
Message
De
20/01/2003 19:02:32
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
20/01/2003 18:55:29
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00743532
Message ID:
00743611
Vues:
20
>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)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform