SQL-Server is ignoring my COLLATION when I'm using LIKE operator

前端 未结 2 1157
慢半拍i
慢半拍i 2021-01-14 01:17

I\'m working with Spanish database so when I\'m looking for and \"aeiou\" I can also get \"áéíóú\" or \"AEIOU\" or \"ÁÉÍÓÚ\", in a where clause like this:

SE         


        
2条回答
  •  悲&欢浪女
    2021-01-14 01:59

    You can use COLLATE, eg.

    SELECT * 
    FROM TableName
    WHERE strData COLLATE Latin1_general_CI_AI = 'perez' COLLATE Latin1_general_CI_AI
    

    both sides must have the same collation.

    • SQLFiddle Demo
    • SQLFiddle Demo (using LIKE)

    Others:

    • Selecting a SQL Server Collation

提交回复
热议问题