I have a field 'Description' which can have product descriptions with any unicode characters. If I search for a description which contains an international character, with a LIKE condition (word searched with does not have the international character) I get the following results:
我有一个字段“Description”,它可以包含任何unicode字符的产品描述。如果我搜索一个包含一个国际字符的描述,并且有一个类似的条件(用搜索的词没有国际字符),我会得到以下结果:
Ex: GEWÜRZTRAMINER
is one of the descriptions. When I do:
例句:GEWURZTRAMINER就是其中之一。当我做:
Select * from table where Description LIKE '%GEWURZTRAMINER%', it retrieves the entry.
When I do:
当我做:
Select * from table where Description LIKE '%GEWURZ%', the entry is not retrieved.
(Note: the search condition does not include the Ü but has a U)
(注:搜索条件不包括U,但有U)
Is there a way around this so that I can retrieve with '%GEWURZ%' as well?
有没有一种方法可以让我用%GEWURZ%检索?
2 个解决方案
#1
5
For bog standard varchar, you'd have to coerce to a accent insensitive collation
对于bog标准varchar,你必须强制一个口音不敏感的排序
Select 1 where 'GEWÜRZTRAMINER' COLLATE LATIN1_GENERAL_CI_AI LIKE '%GEWURZTRAMINER%'
There should be no difference between the calls though for the SQL you provided.
对于您提供的SQL,调用之间应该没有区别。
#2
1
It will depend on the collation order for the column. It should work if you use e.g. SQL_Latin1_General_CP1_CI_AI
这取决于列的排序顺序。如果您使用SQL_Latin1_General_CP1_CI_AI,那么它应该可以工作
#1
5
For bog standard varchar, you'd have to coerce to a accent insensitive collation
对于bog标准varchar,你必须强制一个口音不敏感的排序
Select 1 where 'GEWÜRZTRAMINER' COLLATE LATIN1_GENERAL_CI_AI LIKE '%GEWURZTRAMINER%'
There should be no difference between the calls though for the SQL you provided.
对于您提供的SQL,调用之间应该没有区别。
#2
1
It will depend on the collation order for the column. It should work if you use e.g. SQL_Latin1_General_CP1_CI_AI
这取决于列的排序顺序。如果您使用SQL_Latin1_General_CP1_CI_AI,那么它应该可以工作