作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在Microsoft SQL Server中运行更新查询时出现此错误
Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "SQL_Latin1_General_CP1_CI_AI" in the equal to operation.
最佳答案
AI代表对重音不敏感(即确定cafe =café)。
您可以使用collate关键字转换值中的一个(或两个)排序规则。
有关更多信息,请参见链接:http://msdn.microsoft.com/en-us/library/aa258237(v=sql.80).aspx
示例:DBFiddle
--setup a couple of tables, populate them with the same words, only vary whether to accents are included
create table SomeWords (Word nvarchar(32) not null)
create table OtherWords (Word nvarchar(32) not null)
insert SomeWords (Word) values ('café'), ('store'), ('fiancé'), ('ampère'), ('cafétería'), ('fête'), ('jalapeño'), ('über'), ('zloty'), ('Zürich')
insert OtherWords (Word) values ('cafe'), ('store'), ('fiance'), ('ampere'), ('cafétería'), ('fete'), ('jalapeno'), ('uber'), ('zloty'), ('Zurich')
--now run a join between the two tables, showing what comes back when we use AS vs AI.
--NB: Since this could be run on a database of any collation I've used COLLATE on both sides of the equality operator
select sw.Word MainWord
, ow1.Word MatchAS
, ow2.Word MatchAI
from SomeWords sw
left outer join OtherWords ow1 on ow1.Word collate SQL_Latin1_General_CP1_CI_AS = sw.Word collate SQL_Latin1_General_CP1_CI_AS
left outer join OtherWords ow2 on ow2.Word collate SQL_Latin1_General_CP1_CI_AI = sw.Word collate SQL_Latin1_General_CP1_CI_AI
MainWord
MatchAS
MatchAI
café
cafe
store
store
store
fiancé
fiance
ampère
ampere
cafétería
cafétería
cafétería
fête
fete
jalapeño
jalapeno
über
uber
zloty
zloty
zloty
Zürich
Zurich
关于tsql - SQL_Latin1_General_CP1_CI_AS和SQL_Latin1_General_CP1_CI_AI有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15512321/
我是一名优秀的程序员,十分优秀!