Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Filtering character in a query
Message
 
 
To
28/02/2011 22:02:30
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01502169
Message ID:
01502189
Views:
46
This message has been marked as a message which has helped to the initial question of the thread.
SET @LXListFirstName='S\_SH%'

SELECT Member.Numero
 FROM Member
 WHERE UPPER(Member.FirstName) LIKE @LXListFirstName ESCAPE '\'
 ORDER BY Member.LastName,Member.FirstName 
>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.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform