加入具有不同排序规则问题的列 [英] Join column with different collation issue

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

问题描述

我正在使用SQL Server2005。我有两个表,并且它们使用不同的排序规则。不允许连接具有不同归类的表中的列,例如,不允许使用以下SQL

I am using SQL Server 2005. I have two tables, and they are using different collations. It is not allowed to concatenate columns from tables with different collations, for example the following SQL is not allowed,

select table1column1 + table2column2 from ...

我的问题是,为什么不允许数据库中来自不同归类的两列串联引擎设计角度?我不知道为什么排序规则会影响结果,结果只是连接字符串-应该足够简单,并且不依赖于排序规则...

My question is, why concatenation of two columns from different collations is not allowed from database engine design perspective? I do not know why collation will impact results, the result is just concatenating strings -- should be simple enough and not dependent on collation...

预先感谢,
George

thanks in advance, George

推荐答案

假设 Table1Column1 具有 SQL_Latin1_General_CP1_CI_AS Table2Column2 具有 Latin1_General_CI_AS 。然后,您可以执行以下操作:

Lets say Table1Column1 has SQL_Latin1_General_CP1_CI_AS and Table2Column2 has Latin1_General_CI_AS. Then you can do this:

SELECT Table1Column1 + Table2Column2 COLLATE SQL_Latin1_General_CP1_CI_AS

希望这可以解决您的问题:)

Hope this will solve your problem :)

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

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