Question

I've got 2 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 collation Latin1_General_BIN and serverB uses Latin1_General_CP1_CP_AS and the query refuses to run.

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

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.

Was it helpful?

Solution

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.

OTHER TIPS

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top