SQL Server案例/排序规则问题 [英] SQL Server case/collation issue

查看:194
本文介绍了SQL Server案例/排序规则问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我今天在客户端数据库中有一个奇怪的情况。
SQL Server 2005,数据库排序规则不区分大小写,所以我可以使用任何case写SQL查询,没有任何问题...除了一个。
在一个特定表中的一个特定列,被称为DeadZone。
如果我这样查询:
'从TableName'选择死区 - 我得到一个列未找到错误
像这样:
'从TableName'选择DeadZone - 它工作。
现在的踢球者,像这样:
'从tableName'选择deadZone - 它工作!

I had a weird situation in a clients database today. SQL Server 2005, database collation is case-insensitive, so I can write SQL queries using any case, without any problem ... except one. One particular column, in one particular table, is called 'DeadZone'. If I query like this: 'select Deadzone from TableName' - I get a column not found error like this: 'select DeadZone from TableName' - it works. Now the kicker, like this: 'select deadZone from TableName' - it works!

所以只有Z是区分大小写!
我在同一个表中创建了一个类似的列名,其中有一个'Z',该列不区分大小写。

So only the 'Z' in the column name is case-sensitive! I created a similar column name in the same table, with a 'Z' in it, and that column isn't case-sensitive.

?我相信我可以解决这个问题,可能通过删除和重新添加列,但它是很好的到这一个的底部。
BTW,数据库是在匈牙利的一台电脑上,所以有可能是一些匈牙利特定的字符问题导致这个?记住另一个栏位名称中含有「Z」,并没有相同的问题。

Any ideas? I'm sure I can work around this, probably by dropping and re-adding the column, but it would be good to get to the bottom of this one. BTW, the database is on a PC in Hungary, so is it possible that some Hungarian-specific character issues are causing this? Remembering that another column name with a 'Z' in it did not have the same issue.

-Graeme

推荐答案

确切的排序规则是什么? 匈牙利有一个特殊的Dz字母,可能与D不同,因此您的问题可能实际上是d,而不是z。

What is the exact collation? Hungarian does have a special Dz letter, which might be collated differently from D - so your problem might actually be d, not z.

Deadzone is [D][e][a][dz][o][n][e]
DeadZone is [D][e][a][d][Z][o][n][e]
deadZone is [d][e][a][d][Z][o][n][e]

查看与LY相关的问题: http://www.sqlservercentral.com/Forums/Topic19439-9-1.aspx

See related issue with LY: http://www.sqlservercentral.com/Forums/Topic19439-9-1.aspx

我不认为删除和重新添加您的列会有所帮助。如果要使用匈牙利数据库排序规则,您应该只能使用真正的匈牙利列名称!

And I don't think dropping and re-adding your column is going to help. You should probably only use real Hungarian column names if you are going to use a Hungarian database collation!

这篇关于SQL Server案例/排序规则问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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