Tips & Tricks from C# and SQL Server
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. Can this help ?
Hi Mayukaha,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 name1) Find product names start with an upper case characterselect * 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 characterselect * 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 TestWHERE col1 LIKE '[abcdefghijklmnopqrstuvwxyz]%'collate Latin1_General_CS_AS