'%word -c%'和'%word-%'之间的SQL条款差异

时间:2016-06-14 22:02:59

标签: sql sql-server sql-server-2008

我有以下问题:

SELECT Url FROM Table n WHERE Url LIKE '%sipse.com/milenio/yucatan-%'

返回以下结果集:

> http://sipse.com/milenio/yucatan-estados-
> http://sipse.com/milenio/yucatan-transpor
> http://sipse.com/milenio/yucatan-choferes 
> http://sipse.com/milenio/yucatan-congreso-pleno

但如果我在like参数中添加'c':

SELECT Url FROM Table n WHERE Url LIKE '%sipse.com/milenio/yucatan-c%'

结果集仅更改为下一行:

> http://sipse.com/milenio/yucatan-congreso-pleno

这对我来说很奇怪,因为它应该返回:

> http://sipse.com/milenio/yucatan-choferes 
> http://sipse.com/milenio/yucatan-congreso-pleno

有没有人知道这种行为的原因?

表的排序规则是:SQL Server 2008中的Traditional_Spanish_CI_AS

1 个答案:

答案 0 :(得分:4)

由于它是传统的西班牙语,我们有字母ch(Che)(a,b,c,ch,d ......)。看看:http://www.olcot.co.uk/sql-blogs/revised-difference-between-collation-sql_latin1_general_cp1_ci_as-and-latin1_general_ci_as