Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
String comparisons in SQL SELECT
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00661853
Message ID:
00661872
Vues:
20
Hi!

First of all, even if you have an index by TRCODE, this query will not be optimizable, becasue AllTrim() function.

In queries the best technique is using of "==" and no AllTrim():

SELECT * FROM TABLE WHERE TRCODE == "103 " && or TRCODE == padr("103",{length of TRCODE field})

Hope this helps.

>I am doing a select like this:
>
>SELECT * FROM TABLE WHERE ALLTRIM(TRCODE) = "103"
>
>and I get results that include empty TRCODE values (Character 6).
>If I check at the same time ?ALLTRIM(SPACE(6)) = "103" it returns .F. as I would expect.
>
>Why is the select picking up these records?
>
>following SET's are:
>SET EXACT ON
>SET ANSI OFF
>SET NEAR OFF
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform