Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using datetime index and using with a seek command?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00612987
Message ID:
00613049
Views:
14
>I understand it is not a good idea to use ALLT() in an index expression. Why is it not a good idea to use ALLT() in an index expression? I think someone told me that before, but I don't think it ever caused me a problem. I can remove it and see what happens when I do a seek.

It's a potential problem. Example, your table is defined as f1 C(10), f2 C(3). You have the following records:
f1         f2
---------- ---
ABC        DE
ABCD       E
With an index on f1 + f2, you get:
ABC       DE
ABCD      E
But with an index on ALLTRIM(f1) + ALLTRIM(f2), you get:
ABCDE
ABCDE
If you then SEEK(ALLTRIM(f1) + ALLTRIM(f2)), which one are you going to get? How do you get to the other record?

HTH!
Sylvain Demers
Previous
Reply
Map
View

Click here to load this message in the networking platform