排序规则问题 - SQL Server 2005 [英] Collation Problem - SQL Server 2005

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

问题描述

我想了解我在 SQL Server 2005 实例上遇到的这个错误.以下错误:

I would like to understand this error I'm getting on a SQL Server 2005 instance. Error below:

无法解决排序规则冲突在Latin1_General_CI_AI"和SQL_Latin1_General_CP1_CI_AI"在等于操作.

Cannot resolve the collation conflict between "Latin1_General_CI_AI" and "SQL_Latin1_General_CP1_CI_AI" in the equal to operation.

简单查询中包含的两个数据库都具有Latin1 General CI AI,但之前具有SQL Latin1 General CP1 CI AI.我更改了排序规则以尝试匹配它们,但每次尝试将临时表与用户数据库中的表连接时仍然出现上述错误.我在创建临时表时没有问题.

Both databases included in a simple query have Latin1 General CI AI, but had SQL Latin1 General CP1 CI AI before. I changed the collation trying to match them but still get the aforementioned error every time I try to join a temp table with a table from a user database. I have no issues creating temp tables.

推荐答案

加入后,您可以使用 COLLATE 动态更改排序规则,使它们相同:

When you join you can use COLLATE to change the collation on the fly to make them the same:

select c.name, o.orderid from customer as c
inner join order as o on c.custid = o.custid COLLATE SQL_Latin1_General_CP1_CI_AI

假设 cust 是 SQL_Latin1_General_CP1_CI_AI 并且 order 是其他一些排序规则,上述查询将解决问题.

Assuming that cust is SQL_Latin1_General_CP1_CI_AI and order is some other collation, the above query will fix the problem.

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

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