1

I have 2 rows in my table like this

  • name: Charlie id: 26
  • name: Frank id: 28

I want a case sensitive comparison.

I wrote a query like this

select *  
from table1 
where name in ('charlie', 'Frank') COLLATE Latin1_General_CS_AS; 

but it is not working. What should be the query?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
anonymous_coder
  • 119
  • 1
  • 9

1 Answers1

1

You need to change your column to case sensitive. Something like:

ALTER TABLE table1
ALTER COLUMN name VARCHAR(100) 
COLLATE SQL_Latin1_General_CP1_CS_AS

See https://stackoverflow.com/a/485394/224370 which is a slightly different question, but same answer applies.

Ian Mercer
  • 38,490
  • 8
  • 97
  • 133