amccormack amccormack - 2 years ago 113
SQL Question

SQL Case Sensitive String Compare

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.

Answer Source
Select * from a_table where attribute = 'k' COLLATE Latin1_General_CS_AS 

Did the trick.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download