开发者

SQL Query and Unicode Issue

开发者 https://www.devze.com 2023-02-08 03:16 出处:网络
I have a really weird issue with Sql queries on unicode data. Here\'s what I\'ve got: Sql Server Express 2008 R2 AS

I have a really weird issue with Sql queries on unicode data. Here's what I've got:

  • Sql Server Express 2008 R2 AS
  • Table containing chinese characters/words/phrases (100,000 rows)

When I run the following, I get the correct row + 36 other rows returned... when it should only be the one row:

SELECT TOP 1000 [ID]
      ,[MyChineseColumn]
      ,UNICODE([MyChineseColumn])
  FRO开发者_StackOverflow社区M [dbo].[MyTableName]
  WHERE [MyChineseColumn]= N'㐅'

As you'd expect, the row with is returned, but also the following: , , and a bunch of others...

Anyone have any ideas what is going on here? This has really got me confused and I am not sure how to solve this one (tried "Googling" already)...

Thanks


Please check the column is using an appropriate Chinese collation as that will determine the semantics used in this type of comparison.


You may want to try and use a binary collation, these characters seem to be somehow matched as identical (possibly by ignoring case and/or accents, depending on the used collation).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号