Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Filtering character in a query
Message
De
28/02/2011 22:02:30
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Filtering character in a query
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Web
Divers
Thread ID:
01502169
Message ID:
01502169
Vues:
115
I just discoverd something I was not aware. The _ character is used as a filtering character, such as a wild card, when doing a query. The following:
DECLARE @LXListFirstName Varchar(16)

SET @LXListFirstName='S_SH%'

SELECT Member.Numero
 FROM Member
 WHERE UPPER(Member.FirstName) LIKE @LXListFirstName
 ORDER BY Member.LastName,Member.FirstName 
...will find all records having S as the first character and SH for the 3rd and 4th character no matter what is the second letter. So, it found results such as:

Sushil
Sasha
Sushma
Sushell
Sushi

How can I turn that OFF? Basically, I really needed to find S_Sh as is and not all those records.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform