Two lines are compared equal using '=', but not matching 'like' compare

Sql-Server 2008 R2Sort value Chinese_Simplified_Pinyin_100_CI_AS. When i use

select 1 where N'⑦' = N'7'

it outputs 1, but when I change the operator to like

select 1 where N'⑦' like N'7'

he does not output anything.

Why is the operator likeacting so weird? Did I miss something?

+5
source share
1 answer

This seems to be a mistake. LIKEagainst a wildcard-free pattern should always return the same thing that is being returned =.

Others can see this behavior by running the following query:

SELECT
   CASE WHEN N'⑦' COLLATE Chinese_Simplified_Pinyin_100_CI_AS = N'7' THEN 'Y' ELSE 'N' END,
   CASE WHEN N'⑦' COLLATE Chinese_Simplified_Pinyin_100_CI_AS LIKE N'7' THEN 'Y' ELSE 'N' END
-- Y N

I see that you reported this to Microsoft Connect .

+1
source

All Articles