Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Surrogate Primary Keys - Integer or Character ?
Message
 
 
À
27/07/2000 13:09:03
Mike Yearwood
Toronto, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00397596
Message ID:
00397795
Vues:
23
>
>Integer values use 4 bytes and range from -2147483647 to 2147483647. So maybe the generating of integer keys should start at the negative value. I don't see any problem with having negative factless / surrogate keys. If they are factless, its irrelevant what the value is except for data integrity and a unique value is a unique value no matter what the sign.
>
I don't see a problem with it, but I'm not Drew. ;-)

>BTW, if I'm not mistaken, VMP uses all but 15 of the ASCII characters to generate a key. That means its a base 241 number (instead of base 10 (decimal), base 16 (hexadecimal) or base 256). If I'm not wrong, VMP's biggest primary key value is 812,990,017,200 (812 billion)
>

VMP actually uses a base 67. It limits the available character pool to ASCII values from 36-121 (inclusive) but throws out numerics, punctuation and character delimiters in that range leaving 67 possible values. This produces 1.35 billion combinations plus the 1000 numerics generated before characters are substituted.

>I'm computing that value like this...
>
>Base 10 #'s
> 9,999 = (9*10^3)+(9*10^2)+(9*10)+(9)
>
>Base 241 #'s
> replicate(chr(240),4) = (240*241^4)+(240*241^3)+(240*241^2)+(240*241)+(240)
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform