Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Filtering character in a query
Message
From
28/02/2011 22:02:30
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Filtering character in a query
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01502169
Message ID:
01502169
Views:
114
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
Next
Reply
Map
View

Click here to load this message in the networking platform