How do you compare strings so that the comparison is true only if the cases of each of the strings are equal as well. For example:
Select * from a_table where attribute = 'k'
...will return a row with an attribute of 'K'. I do not want this behaviour.
A string comparison is case sensitive when you don't want it to be, or vice versa.
Case insensitive SQL SELECT: Use upper or lower functions or this: select * from users where lower(first_name) = 'fred'; As you can see, the pattern is to make the field you're searching into uppercase or lowercase, and then make your search string also be uppercase or lowercase to match the SQL function you've used.
compareTo(string2) is case-sensitive. Meaning that all Capital letters come before the lowercase letters.
Select * from a_table where attribute = 'k' COLLATE Latin1_General_CS_AS
Did the trick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With