Thursday, January 7, 2010

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

If you are using a stored procedures that use temporary tables, then be aware that temporary tables created within a stored procedure use the tempdb database’s collation instead of the current user database’s collation. Tempdb is created at installation and is assigned the default collation.

Use 'COLLATE DATABASE_DEFAULT' to resolve the collation conflict, e.g.

SELECT * FROM TableA
WHERE ID COLLATE DATABASE_DEFAULT
IN (SELECT TableAID FROM #temp)

References:
SQL SERVER – Cannot resolve collation conflict for equal to operation
Collation Conflict
blog comments powered by Disqus