I have a product name table with products names collected both in upper and lower cases. I want to pull out product names that start with lower/uppper cases.
The aforementioned query is to return rows when atleast one lower character present in the value.
For your requirement, try the following queries. I've just used "product_name" as the tbale name and "name" as the column name 1) Find product names start with an upper case character
select * from product_name where LEFT(name,1) = UPPER(LEFT(name,1)) COLLATE Latin1_General_CS_AS
2) Find product names start with an lower case character
select * from product_name where LEFT(name,1) = LOWER(LEFT(name,1)) COLLATE Latin1_General_CS_AS
Or you could change slightly (remove the first %) to achieve the same result. SELECT * FROM Test WHERE col1 LIKE '[abcdefghijklmnopqrstuvwxyz]%' collate Latin1_General_CS_AS
I have a product name table with products names collected both in upper and lower cases. I want to pull out product names that start with lower/uppper cases.
ReplyDeleteCan this help ?
Hi Mayukaha,
ReplyDeleteThe aforementioned query is to return rows when atleast one lower character present in the value.
For your requirement, try the following queries. I've just used "product_name" as the tbale name and "name" as the column name
1) Find product names start with an upper case character
select * from product_name where
LEFT(name,1) = UPPER(LEFT(name,1)) COLLATE Latin1_General_CS_AS
2) Find product names start with an lower case character
select * from product_name where
LEFT(name,1) = LOWER(LEFT(name,1)) COLLATE Latin1_General_CS_AS
Excellent. Thanks!
ReplyDeleteOr you could change slightly (remove the first %) to achieve the same result.
ReplyDeleteSELECT *
FROM Test
WHERE col1
LIKE '[abcdefghijklmnopqrstuvwxyz]%'
collate Latin1_General_CS_AS