Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SEEK and LOCATE and UPPER and ALLTRIM
Message
De
14/01/2009 01:55:54
 
 
À
13/01/2009 21:28:13
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01373413
Message ID:
01373440
Vues:
25
This message has been marked as the solution to the initial question of the thread.
>>>There is an index on TableFormProperties.TableName, but the date is in mixed case, so I can't do a SEEK (or can I?). I'm doing this in a LOCATE, but that seems a bit wrong somehow. Is this the right way to do it, or is there a better way.
>>>
>>>lcTableName = "MyTableName"
>>>SELECT TableFormProperties
>>>LOCATE FOR ALLTRIM(UPPER(TableName) = ALLTRIM(UPPER(lcTableName))
>>>
>>
>>It's correct except for the typo.
>>
>>LOCATE FOR ALLTRIM(UPPER(TableName)) = ALLTRIM(UPPER(lcTableName))
>>
>>Either this or
>>
>>LOCATE FOR UPPER(TableName) = PADR(ALLTRIM(UPPER(lcTableName)),LEN(TableName))
>
>Is one better than the other? The first seems simpler.

I think the second is probably better, for two reasons.

1. If you add an index on UPPER(TableName) it will become optimizable. You will probably never create an index tag that the first expression would optimize.

2. Depending on the status of SET EXACT, the first expression could give a false found() if lcTableName is a partial match for a real TableName.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform