SQL Server query for two related databases using different mappings

I have two remote databases as part of a query

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 sorting Latin1_General_BIN, and serverB uses Latin1_General_CP1_CP_AS, and the request refuses to start.

Both servers are SQL 2000 servers. Both databases are installed in stone, so I cannot change their sortings, unfortunately.

Anyway, do you guys know how to make this work?

Update: I found an alternative solution. In the properties of the linked server, you can specify the mapping of linked servers.

+3
source share
2 answers

Just add the sort to your selection, for example:

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

. "" .

+9

:

select * from profile, userinfo
where profile.custid collate database_default = userinfo.custid collate database_default
+2

Source: https://habr.com/ru/post/1699054/


All Articles