Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Filtering character in a query
Message
From
28/02/2011 22:29:54
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01502169
Message ID:
01502175
Views:
32
>Try
>
>where FirstName LIKE 'S[_]SH%' ([ are the escape characters)

I tried it and it worked. So, basically, in order to avoid that, for SQL Server, I should parse a criteria entered by the user and simply encapsulate it between those [] characters.

>Also, in SQL Server most installations are case insensitive, so using UPPER function makes your query non sargable. If you want to be 100% sure it will work you can use COLLATE keyword to use non case-sensitive collation.

Yes, the UPPER() is there to support various backends. I was not aware it was causing a downsize. Is it? You mentioned "non sargable". Is it something that can slow down the query once in a while? If yes, than I should call a method to adjust to have UPPER or not base on the backend.
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform