Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Locate upper case characters in SQL Server database field

Tags:

sql-server

I need to locate rows in a database table that have a field with an upper case value.

E.g.: select * from Cust where Surname like 'COnTAiNS UpPERcASE VaLUeS'

Any assistance would be appreciated.

AJ

like image 222
AnthonyJ Avatar asked Nov 17 '11 00:11

AnthonyJ


1 Answers

You can do a binary comparison using:

select *
from Cust
where cast(Surname as varbinary(120)) != cast(lower(Surname) as varbinary(120))
like image 122
garyf Avatar answered Dec 17 '22 04:12

garyf