使用 2 个版本的 SQL Server 的排序规则冲突
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20173099/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Collation conflict using 2 versions of SQL Server
提问by sumit
I am working on 2 versions of SQL Server i.e 2005 and 2008 R2.
我正在开发 2 个版本的 SQL Server,即 2005 和 2008 R2。
From 2008 R2 I have created a linked server which will connect to an older SQL Server 2005 instance.
从 2008 R2 开始,我创建了一个链接服务器,它将连接到旧的 SQL Server 2005 实例。
I have one table on my server (2008) which is as below
我的服务器(2008)上有一张桌子,如下所示
members
成员
id name
0002320 AOne Enterprises Motihari
0002321 AOne Enterprises Siliguri
Another table which resides on remote server contain activity of each agent
位于远程服务器上的另一个表包含每个代理的活动
id member_code agent rr_no txn_date amount
I fired a query below
我在下面发起了一个查询
select top 5 *
from [192.168.6.3].sync.dbo.agents_log
where member_code IN
(select id from members where name like 'AOne Enterprises%')
I was trying to pull all activity log of AOne Enterprises through out the country which is in distributed database , so I need to create a link servers.
我试图将AOne Enterprises的所有活动日志拉到分布式数据库中的国家/地区,因此我需要创建一个链接服务器。
I got this error:
我收到此错误:
Msg 468, Level 16, State 9, Line 1
Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Latin1_General_BIN" in the equal to operation.
消息 468,级别 16,状态 9,第 1 行
无法解决“SQL_Latin1_General_CP1_CI_AS”和“Latin1_General_BIN”之间的对等操作的排序规则冲突。
回答by sumit
not exactly sure what you need, but if its only collation issue you can do below
不完全确定你需要什么,但如果它是唯一的整理问题,你可以在下面做
SELECT TOP 5 *
FROM [192.168.6.3].sync.dbo.agents_log
WHERE member_code COLLATE SQL_Latin1_General_CP1_CI_AS
IN (SELECT id
FROM members
WHERE NAME LIKE 'AOne Enterprises%')
I just added COLLATE SQL_Latin1_General_CP1_CI_AS, perhaps it work
我刚刚添加了COLLATE SQL_Latin1_General_CP1_CI_AS,也许它有效