Link to home
Start Free TrialLog in
Avatar of ngwsls
ngwslsFlag for United States of America

asked on

Search for lowercase instances in a case-insensitive column

I have a table in my SQL Server 2005 database that contains customer IDs.  Example:
CULSTA2
culsta2
BILBOA
SUNSUP
AQUCON
aqucon

and so on.  I need to be able to identify anytime there's an entry of any lower case entry, separate from the correct entry of all upper case.  My database is set as case-insensitive but the application that uses it interprets the data differently if it is lower case rather than all upper case.

So in the set shown above, I'd just be looking for culsta2 and aqucon, and NOT CULSTA2 or AQUCON.

Help?
Thanks
Van

Avatar of sgvill
sgvill

Anytime you use it, you could send it as UPPER(ID).  
ASKER CERTIFIED SOLUTION
Avatar of Rajkumar Gs
Rajkumar Gs
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
oops. misread what you wrote.  You can use a query like this:

select * from yourtable where cast(ID as varbinary(100)) <> cast(upper(ID) as varbinary(100))

and your varbinary can be as small as your IDs are
Avatar of ngwsls

ASKER

Perfect!  It worked!  Thanks so much!