Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Primary key
Message
De
19/03/2003 07:44:29
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
19/03/2003 03:57:18
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00766466
Message ID:
00767443
Vues:
15
>HI,
>Do you prefer to use Integer value or STR(Integer value) as primary key ?
>
>Thank you

To assure uniqueness in a single integer field, I would just create a candidate index on the single field - no str(), which would simply add overhead, which I believe is unnecessary in this case.

To assure uniqueness in any other single field, I would also use the field itself.


To ensure uniqueness among two or more fields, the simplest method is usually to everything to character, and concatenate (use "+" to combine the character expressions).

For integers, it turns out that bintoc() (VFP 5 or later) takes up much less space than str().

An example, involving a character, an integer, and a date:
index on MyCharacter + bintoc(MyInteger) + dtos(MyDate) tag MyIndex
dtos() is suitable for dates, since it is independent of the date format.
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform