Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to create composite index on Integer fields?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00063211
Message ID:
00063261
Views:
54
>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?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform