|
Posted by Erland Sommarskog on 09/29/84 11:25
(ozburger@gmail.com) writes:
> I am trying to do a select statement with SQL 2000 for all records
> containing any number of lowercase letters. I have tried the following
> 2 statements and they both seem to match both lowercase and uppercase
> letters.
>
> SELECT * FROM customers WHERE name LIKE '%[a-z]%'
>
> SELECT * FROM customers WHERE name LIKE
> '%[abcdefghijklmnopqrstuvwxyz]%'
SELECT * FROM customers
WHERE name COLLATE Latin1_General_BIN LIKE '%[a-z]%'
You must cast to a binary collation, as in a case-sensitive collation,
a-z ranges something like aBcDC ... Zz. And in a case-insenstive collation
a-z is equivalent to A-Z.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp
Navigation:
[Reply to this message]
|