ngwsls
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
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
Anytime you use it, you could send it as UPPER(ID).
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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
ASKER
Perfect! It worked! Thanks so much!