I've got 2 remote databases as part of a query
我有2个远程数据库作为查询的一部分
select p.ID,p.ProjectCode_VC,p.Name_VC,v.*
FROM [serverB].Projects.dbo.Projects_T p
LEFT JOIN [serverA].SOCON.dbo.vw_PROJECT v on
p.ProjectCode_VC = v.PROJ_CODE
The problem is that serverA uses collation Latin1_General_BIN
and serverB uses Latin1_General_CP1_CP_AS
and the query refuses to run.
问题是serverA使用排序规则Latin1_General_BIN而serverB使用Latin1_General_CP1_CP_AS并且查询拒绝运行。
Both servers are SQL 2000 servers. Both databases are set in stone so I cannot change their collations, unfortunately.
两台服务器都是SQL 2000服务器。两个数据库都是一成不变的,所以不幸的是我无法更改它们的排序规则。
Is there anyway you guys know how to get this to work?
无论如何你们都知道如何让它发挥作用吗?
Update: I found an alternative solution. In the Linked Server Properties, you can specify the linked server's collation there.
更新:我找到了另一种解决方案。在“链接服务器属性”中,您可以在那里指定链接服务器的排序规则。
2 个解决方案
#1
9
Just add the collation to your select, like:
只需将排序规则添加到您的选择中,例如:
select
p.ID,
p.ProjectCode_VC,
p.Name_VC,
v.*
FROM
[serverB].Projects.dbo.Projects_T p
LEFT JOIN [serverA].SOCON.dbo.vw_PROJECT v on p.ProjectCode_VC
collate Latin1_General_Bin = v.PROJ_CODE
or the other way around. So "convert" one of the collations to the other.
或者相反。因此,将其中一个归类“转换”为另一个归类。
#2
2
Or you can use a more generic query like this:
或者您可以使用这样的更通用的查询:
select * from profile, userinfo
where profile.custid collate database_default = userinfo.custid collate database_default
#1
9
Just add the collation to your select, like:
只需将排序规则添加到您的选择中,例如:
select
p.ID,
p.ProjectCode_VC,
p.Name_VC,
v.*
FROM
[serverB].Projects.dbo.Projects_T p
LEFT JOIN [serverA].SOCON.dbo.vw_PROJECT v on p.ProjectCode_VC
collate Latin1_General_Bin = v.PROJ_CODE
or the other way around. So "convert" one of the collations to the other.
或者相反。因此,将其中一个归类“转换”为另一个归类。
#2
2
Or you can use a more generic query like this:
或者您可以使用这样的更通用的查询:
select * from profile, userinfo
where profile.custid collate database_default = userinfo.custid collate database_default