Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using SQL indexes
Message
From
08/08/2001 11:00:58
 
 
To
08/08/2001 10:05:26
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00541265
Message ID:
00541298
Views:
14
>I have created some stored procedures in SQL and they contain indexes. As you know SQL indexes speed up the query. The problem is, at times I want to wrap the field(s) being selected in RTRIM or LTRIM. The proble is this sows down the query, because it does not use the INDEX.
>
> have any of you guys 'Who use SQL server' run into this problem, and if so how did you handle it?
>
> I resorted to useing padding of spaces on the variable passed to SQL. Are there any other solutions?

Why do you wrap it rtrim or ltrim?
if you look for 'Smith' in a column it's should just find the rows that have 'Smith' as the value of that column - not e.g., 'Smithy' or 'Smithereen'.
or are you concatenating? if so, separate the concatenation into individual expressions. "compound" indexes in SQL Server are really covered, not concatenated like in VFP.

e.g., VFP:
use people
index on clastname+cfirstname tag fullname


would be this in SQL Server create index fullname on people (clastname, cfirstname)
This is covered, meaning that you can use ...where clastname = 'Smith' and cfirstname = 'John'... instead of ...where rtrim(clastname)+rtrim(cfirstname)='SmithJohn'...

or is it some other reason?
Insanity: Doing the same thing over and over and expecting different results.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform