Home > SQL Server > Cannot resolve collation … conflict for equal to operation

Cannot resolve collation … conflict for equal to operation

2013/01/29

I have restored a SQL server backup into a Sql 2012 instance from a 2008 server, and i got into troubles with the message above, the subject of this post.

The problem was related to temp tables, on stored procedures code where is used a temp table in a join or a select ; the exact error was

Cannot resolve the collation conflict between \”Latin1_General_CI_AS\” and \”SQL_Latin1_General_CP1_CI_AS\” in the equal to operation temp tables

Probably there is a better solution, but a quick and dirty solution is to add “COLLATE DATABASE DEFAULT” in the text fields definitions, for example:

CREATE TABLE #StcTemp (STC varchar(3) collate database_default, NEW int)

After adding the COLLATE DATABASE DEFAULT to every text field (varchar, char) no more errors .

Advertisements
Categories: SQL Server
%d bloggers like this: