Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to create composite index on Integer fields?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00063211
Message ID:
00063261
Vues:
52
>I have a composite key that consists of two integer fields. How do I create the composite key?
>
>If I do STR(iKey1)+STR(iKey2), I will get a long string, right? I can't alltrim them because that will make the composite index wrong, right? Do I have to fix the number of characters for each field of the composite key?
>
>Thanks in advance.

If iKey1 is, say, a 5 digit field, you could have an index expression 100,000*iKey1 + iKey2. A tag like this could come in handy for ordering things if you are using the table itself, and not a view. But as many people here have told me, avoid compound primary keys and meaningful primary keys. At the very least, if you use compound keys, you will have to write your own RI code, because the RI code generated by vfp won't handle them. It is better to generate a surrogate key.

What does everyone think about him using this tag for a candidate index?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform