简体   繁体   English

无法解决 Join 语句中的排序规则冲突

[英]Cannot Resolve Collation Conflict in Join Statement

I have the following join, that spits out this error我有以下加入,会吐出这个错误

"Cannot resolve the collation conflict between "Latin1_General_BIN" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation. “无法解决等于操作中“Latin1_General_BIN”和“SQL_Latin1_General_CP1_CI_AS”之间的排序规则冲突。

I tried editing by adding:我尝试通过添加进行编辑:

ns.dw_item_location COLLATE Latin1_General_BIN AS dil

as well as

ns.dw_item_location COLLATE SQL_Latin1_General_CP1_CI_AS AS dil

and didn't resolve this error.并没有解决这个错误。 I also tried我也试过

IR.ItemNo COLLATE_Latin1_General_BIN as ItemNo

earlier in the SQL statement and still no resolution.早在 SQL 声明中,仍然没有解决方案。

left join ns.dw_item_location dil on dil.znumber = IR.ItemNo

The expected outcome should resolve this error by correcting the correlation预期结果应通过纠正相关性来解决此错误

You are putting the collate in the wrong place.你把整理放在错误的地方。 You should put it immediately after the column name inside the equals clause你应该把它放在equals子句中的列名之后

left join ns.dw_item_location dil on dil.znumber collate database_default = IR.ItemNo

You will notice I used database_default meaning "whatever the current database uses" which is usually simpler if you have a conflict between "this" database and "another" database.您会注意到我使用了 database_default 意思是“无论当前数据库使用什么”,如果您在“这个”数据库和“另一个”数据库之间存在冲突,这通常更简单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM