Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need assistance optimizing a select statement
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00855104
Message ID:
00855312
Views:
15
Neil,
>  Ufrag = '%'+UPPER(tcLastNameFragment)+'%' ;
>  cnLEN = TRANSFORM(LEN(tcLastNameFragment));
>  SUBY = " SUBSTR(UPPER(title),1," + cnLEN + ") like '" ;
LIKE %something% is not optimizeable.

LIKE something% is optimizeable using an index on lastname

>If I pass "GOR" to the method, the select statement will return 3 the following 3 names as it should:
>GORE
>GORIN
>GORY
>
>If I pass in "T" to the method, every name that starts with "T" is found.
>Select statement works but lacks opitimization.

If you really only want names that start with the fragment

uFrag = upper( alltrim( tcLastNameFragment ) )
[where upper(lastname) = '] + uFrag + [']

should work for you.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform