Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Optimization of Select stmt
Message
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Titre:
Optimization of Select stmt
Divers
Thread ID:
00811925
Message ID:
00811925
Vues:
56
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.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform