Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 errror in collation

Author  Topic 

monfu
Yak Posting Veteran

81 Posts

Posted - 2008-08-22 : 14:26:28
Dear All

I am trying to transfer some data from an old database to a new database, however I am getting the following error:-

Cannot resolve the collation conflict between "Latin1_General_CI_AS" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation.

My code is like this:-

INSERT INTO #temp_OldMatches
(
matchID,matchDate,matchType,cupName,TeamB,clubName,Venue,HTScore,FTScore,FormTeamA,FormTeamB,Scorers,Ref,RedCards,Commentary
)
SELECT TOP 10 matchID,matchDate,matchType,(SELECT cupName FROM hamrunMatchesSQL.dbo.Cups WHERE cupID = hamrunMatchesSQL.dbo.Matches.matchType),
TeamB,(SELECT clubName FROM hamrunMatchesSQL.dbo.Clubs WHERE clubID = hamrunMatchesSQL.dbo.Matches.TeamB),
Venue,HTScore,FTScore,FormTeamA,FormTeamB,
Scorers,Ref,RedCards, Commentary
FROM hamrunMatchesSQL.dbo.Matches

Can you please tell me what I have to do to get it to work

Thanks

Johann

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-08-22 : 14:34:17
Looks like database are in diferent collation.You need to explicitly specify desired collation in your insert statement.
Go to Top of Page

monfu
Yak Posting Veteran

81 Posts

Posted - 2008-08-22 : 14:37:10
Hi sodeep

Can you give me an example how to achieve that please

thks
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-08-22 : 14:45:50
Maybe this:

quote:
Originally posted by monfu

Dear All

I am trying to transfer some data from an old database to a new database, however I am getting the following error:-

Cannot resolve the collation conflict between "Latin1_General_CI_AS" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation.

My code is like this:-

INSERT INTO #temp_OldMatches
(
matchID,matchDate,matchType,cupName,TeamB,clubName,Venue,HTScore,FTScore,FormTeamA,FormTeamB,Scorers,Ref,RedCards,Commentary
)
SELECT TOP 10 matchID,matchDate,matchType,(SELECT cupName FROM hamrunMatchesSQL.dbo.Cups WHERE cupID collate SQL_Latin1_General_CP1_CI_AS = hamrunMatchesSQL.dbo.Matches.matchType collate SQL_Latin1_General_CP1_CI_AS ),
TeamB,(SELECT clubName FROM hamrunMatchesSQL.dbo.Clubs WHERE clubID collate SQL_Latin1_General_CP1_CI_AS = hamrunMatchesSQL.dbo.Matches.TeamB collate SQL_Latin1_General_CP1_CI_AS ),
Venue,HTScore,FTScore,FormTeamA,FormTeamB,
Scorers,Ref,RedCards, Commentary
FROM hamrunMatchesSQL.dbo.Matches

Can you please tell me what I have to do to get it to work

Thanks

Johann

Go to Top of Page

monfu
Yak Posting Veteran

81 Posts

Posted - 2008-08-22 : 14:56:10
excellent!

Thanks sodeep!

much appreciated
Go to Top of Page
   

- Advertisement -