Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

T-SQL Query That Returns lower case Results Only

I have a table named "KEYWORDS" with a column named "ENTRY" of VARCHAR(10). Would it be possible to retrieve only the lower-case entries from that table?

For example, the table might look like this:

ENTRY
===========
SearchString
Searchstring
searchstring
SEARCHSTRING

And I would like to be able to run a query that looks similar to:

SELECT ENTRY FROM KEYWORDS WHERE ENTRY <condition to retun only the lowercase entry>

where the result of the above would be: searchstring

And if that can be done, then I would like to be able to retrieve only the ProperCase entries next. This is a hosted SQL Server 2005 database on GoDaddy.com hosting so I dont know much about how its configured. I do not have permission to run EXEC sp_help DatabaseName

I will reference this page: http://blog.sqlauthority.com/2007/04/30/case-sensitive-sql-query-search/ which was interesting to read because its similar to what I am looking for but different in that the person running the query knows what they are looking for.

I would like ALL entries that are lowercase.

like image 939
ONDEV Avatar asked Sep 16 '11 01:09

ONDEV


1 Answers

Try this:

where Entry COLLATE Latin1_General_CS_AS = Lower(entry)
like image 177
Ramy Avatar answered Oct 01 '22 17:10

Ramy