SQL查询和Unicode问题 [英] SQL Query and Unicode Issue

查看:145
本文介绍了SQL查询和Unicode问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Unicode数据的Sql查询有一个很奇怪的问题。这是我得到的:

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


  • Sql Server Express 2008 R2 AS

  • 包含汉字的表/ words /词组(100,000行)

当我运行以下命令时,我得到了正确的行+返回的其他36行...

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])
  FROM [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)...

谢谢

推荐答案

请检查该列是否使用了适当的中文排序规则,因为这将确定在这种类型的比较中使用的语义。

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

这篇关于SQL查询和Unicode问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆