amccormack amccormack - 6 months ago 14
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
Select * from a_table where attribute = 'k' COLLATE Latin1_General_CS_AS 

Did the trick.

Comments