Reputation: 10414
Subquestioning the answer to my other question:
How to better compare 2 (non-N') symbols using explicitly a collation which is different from a default database collation?
Update: I need to compare char() or varchar() values I extracted from a database and put them into variables @s1 and @s2
use dbName;
--here I alternated different db names with different collations
declare @s1 nchar(1)='à'
declare @s2 nchar(1)='a'
select
case
when @s1 <> @s2 Then 'a is NOT equal à'
else 'a is equal to à'
end
collate latin1_General_CS_AS
outputs
Upvotes: 0
Views: 2678
Reputation: 239764
You're telling it how to collate the strings 'a is NOT equal à' and 'a is equal to à', rather than for the comparison:
declare @s1 nchar(1)='à'
declare @s2 nchar(1)='a'
select
case
when @s1 <> @s2 collate latin1_General_CS_AS Then 'a is NOT equal à'
else 'a is equal to à'
end
Upvotes: 2