Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Optimization of Select stmt
Message
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
Other
Title:
Optimization of Select stmt
Miscellaneous
Thread ID:
00811925
Message ID:
00811925
Views:
54
I am using the following SQL Select statement but it is running VERY slow. I ran the Index Tuning Wizard and it gave no recommendations. How can I get this to run faster:
SELECT * FROM customer where UPPER(RTRIM(clastname)) = '" + myLastVar + "' AND UPPER(RTRIM(cfirstname)) = '" + myFirstVar + "' AND UPPER(RTRIM(cmailzip)) = '" + myZipVar + "'"
This select statement runs MUCH faster:
SELECT * FROM customer where clastname = '" + myLastVar + "' AND cfirstname = '" + myFirstVar + "' AND cmailzip = '" + myZipVar + "'"
The problem is that I need to run the check with case insensitivity and I need an exact match like the following:

In Table Variable to Check Expected Results
-------- ----------------- ----------------
Smith SMITH Find Match
Smithion SMITH No Match
Smith Smithion No Match


How can I do this select more efficiently? Thank you for any help.
Next
Reply
Map
View

Click here to load this message in the networking platform