我有一个SQL查询,该查询将数据库中的值与常量进行比较:
SELECT * FROM my_table INNER JOIN #TempTable tem ON my_table.id = temp.id AND my_table.key = 'SOME STRING'
我得到了错误:
Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Latin1_General_CI_AS" in the equal to operation.
我该如何解决?(无需更改数据库)
更新:即使删除了最后一个like(字符串比较),我也会收到此错误…
看来你id的是VARCHARs的不同的排序规则。
id
VARCHAR
试试这个:
SELECT * FROM my_table INNER JOIN #TempTable tem ON my_table.id = temp.id COLLATE SQL_Latin1_General_CP1_CI_AS AND my_table.key = 'SOME STRING'