Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
The best way to use a portion of a field for indexing
Message
De
11/01/2005 07:29:48
 
 
À
11/01/2005 07:14:50
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
00975802
Message ID:
00975981
Vues:
33
>>>>Hi Walter,
>>>>
>>>>yes, but it your case, why? INDEX ON FirstName-LastName gives EXACTLY the same result! One of the little used features of xBase.
>>>
>>>This is not true:
>>>
>>>FirstName-LastName
>>>is
>>>PADR(RTRIM(FirstName)+LastName,FSIZE(FirstName)+FSIZE(LastName))
>>>
>>>
>>>>
>>>>OK, I admit I should have use the word "as", and not "in". 'Never use alltrim as an index expression. Thank you for the correction.
>>>>
>>>>>Hi Tore,
>>>
>>>Then:
>>>
>>>Never use LTRIM()
>>Correct
>>
>>>Never use RTRIM()
>>Correct
>>
>>>and then
>>>NEVER USE OF A VARCHAR FIELD ON VFP9 !
>>Wrong. A varchar field has a maximum length which will be the key length
>
>Sure but this is true for a RTRIM(cFiled),LTRIM(cField),ALLTRIM(cField) also:
>
>CREATE CURSOR TEST (FC C(10),FV V(10))
>INDEX RTRIM(FC) TAG T1
>INDEX FV        TAG T2
>* INDEX T1 AND T2 ARE EQUAL, EXACTLY EQUAL
>
>
>Try to use a varchar with SET EXACT OFF or SET ANSI OFF !
>You will have the time of drink many coffees.
CREATE CURSOR TEST (FC C(10),FV V(10))
APPEND BLANK && You must have this line here!!
INDEX RTRIM(FC) TAG T1
INDEX FV        TAG T2
I promise you, from experience, that this will give wrong result AFTER SOME TIME! Unless, and this is important, Microsoft has changed something during the last few years.

By the way, your comments about SET EXACT and SET ANSI is correct, but I won't bring in too many factors.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform