Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
The best way to use a portion of a field for indexing
Message
From
11/01/2005 05:54:34
 
 
To
11/01/2005 05:43:08
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00975802
Message ID:
00975968
Views:
38
>>Hi Tore,
>>
>>>Remove the ALLTRIM function!!! NEVER, NEVER, NEVER use ALLTRIM in an index expression! And this rule has NO exceptions!
>>
>>NEVER SAY NEVER :) . The rule is that each index expression should has the same fixed length. ALLTRIM() certainly is a threat but an index expression of:
>>
>>
INDEX ON PADR(ALLTRIM(FirstName)+ALLTRIM(LastName),40)
>>
>>is perfectly valid.
>>
>>Walter,
>
>Why PADR ?
>
>It is unnecessary.
>
>CREATE CURSOR byby (c c(2))
>INDEX on ALLTRIM(C)+ALLTRIM(C) TAG t1 && VFP build a key with LEN(KEY())=FSIZE('C')+FSIZE('C')

Try with a blank record as your first record, and you will see the problem. All index expression must give a fixed length key!

>? SEEK('11')
>INSERT INTO byby VALUES ('12')
>INSERT INTO byby VALUES (' 2')
>? SEEK('1212')
>? SEEK('22')
>
>
>Fabio
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform