Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Composite primary keys
Message
De
01/12/2004 10:05:40
 
 
À
01/12/2004 09:42:02
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00966059
Message ID:
00966067
Vues:
8
Hi David,

You should always use a 'meningless' field, for instance an autoincremented numeric field, and index on that for your primary key.

>Hello,
>
>If I understood it correctly, the VFP database supports the use of a composite primary key only through function-based indexes. So if I take the following situation:
>
>Table A, key A_id (character)
>Table B, key B_id (auto-incremented integer)
>Table C establishing a m-n relationship between A and B, key (A_id,B_id)
>For C's primary key I have to create an index based on a function like A_id+TRIM(STR(B_id))
>
>That is probably what I will often have to do as I will have to add tables using auto-increments to an existing database which is using only character primary keys. It will certainly work. But now, It looks to me as I will be losing all benefits of using the more compact integer keys over the longer character keys. Is there a cleverer way to define a composite key ?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform