Ayorus
Ayorus

Reputation: 507

SQL like clause difference between '%word-c%' and '%word-%'

I have the follwing query:

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

Which returns the following result set:

> 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

But if I add a 'c' to the like parameter:

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

The result set changes to only the next row:

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

Which is very strange to me because it should return:

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

Does anyone have any idea about the reason of this behavior?

The collation of the Table is: Traditional_Spanish_CI_AS in SQL Server 2008

Upvotes: 1

Views: 65

Answers (1)

vercelli
vercelli

Reputation: 4767

Since it is traditional Spanish we have the letter ch (Che) (a, b, c, ch, d...). Take a look: http://www.olcot.co.uk/sql-blogs/revised-difference-between-collation-sql_latin1_general_cp1_ci_as-and-latin1_general_ci_as

Upvotes: 4

Related Questions