declare @x1 varchar(100), @x2 varchar(100)
set @x1='12345'+char(178)
set @x2='123452'
select @x1, @x2, cast(@x1 as nvarchar(200))
select case when @x1=@x2 then 1 else 0 end as simple_compare,
case when cast(@x1 as varbinary)=cast(@x2 as varbinary) then 1 else 0 end as binary_compare,
case when @x1=@x2 COLLATE Latin1_General_CI_AI then 1 else 0 end as collate_compare1,
case when @x1=@x2 COLLATE Latin1_General_CS_AI then 1 else 0 end as collate_compare2,
case when @x1=@x2 COLLATE Latin1_General_BIN then 1 else 0 end as collate_compare3 |