无法解决“SQL_AltDiction_CP850_CI_AS"之间的排序规则冲突和“SQL_Latin1_General_CP1_CI_AS"在等于操作中 [英] Cannot resolve the collation conflict between "SQL_AltDiction_CP850_CI_AS" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation
问题描述
我的存储过程中有一段代码如下 -
I have a piece of code in my stored procedure as below -
update tblexpwitretrocmdocs set sCheckedOut = A.sEditor, idone = 0
from #tblDocs A
JOIN tblexpwitretrocmdocs B ON A.SID = B.SID
where A.iDocumentTypeId in (16,17,13,11)
and A.sid not in (select SID COLLATE SQL_AltDiction_CP850_CI_AS from tblexpwitdocumentgeneral)
我收到错误无法解决等于操作中SQL_AltDiction_CP850_CI_AS"和SQL_Latin1_General_CP1_CI_AS"之间的排序规则冲突."对于第一行代码.
I am getting the error "Cannot resolve the collation conflict between "SQL_AltDiction_CP850_CI_AS" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation." for the first line of code.
表中的 sCheckedOut 列 - tblexpwitretrocmdocs 具有排序规则 SQL_AltDiction_CP850_CI_AS.因此,为了使列 - sEditor 与其兼容,我将临时表定义如下 -
The column - sCheckedOut in table - tblexpwitretrocmdocs has collation SQL_AltDiction_CP850_CI_AS. So to make the column - sEditor compatible to it, I defined the temp table as below -
CREATE TABLE #tblDocs(
iId INT IDENTITY (1,1),
SID NVARCHAR(50) COLLATE SQL_AltDiction_CP850_CI_AS,
iDocumentTypeId INT,
sType NVARCHAR(200),
sEditor NVARCHAR(50) COLLATE SQL_AltDiction_CP850_CI_AS
)
我仍然遇到同样的错误.请帮我解决这个问题.
Still I am getting the same error. Please help me resolve this.
推荐答案
要解决排序规则冲突,请在="运算符周围添加COLLATE DATABASE_DEFAULT" 关键字,如下所示:
To resolve the collation conflict add "COLLATE DATABASE_DEFAULT" keywords around "=" operator as shown below:
UPDATE tblexpwitretrocmdocs SET sCheckedOut = A.sEditor, idone = 0
FROM #tblDocs A
JOIN tblexpwitretrocmdocs B ON A.SID = B.SID
WHERE A.iDocumentTypeId in (16,17,13,11) COLLATE DATABASE_DEFAULT
AND A.sid COLLATE DATABASE_DEFAULT NOT IN
(SELECT SID COLLATE DATABASE_DEFAULT FROM tblexpwitdocumentgeneral)
希望这有帮助...
这篇关于无法解决“SQL_AltDiction_CP850_CI_AS"之间的排序规则冲突和“SQL_Latin1_General_CP1_CI_AS"在等于操作中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!