I want to search with "copiers" and "copier". I want the same result in both case. can it is possible in sql server?
我想用“复印机”和“复印机”来搜索。我想在两种情况下得到相同的结果。在sql server中可以吗?
select * from Item where ItemName like '%copiers%'
2 个解决方案
#1
3
You will need to set up Full Text Search
您需要设置全文搜索。
From that page:
从这个页面:
... queries can search for any of the following:
…查询可以搜索下列任何一种:
- One or more specific words or phrases (simple term)
- 一个或多个特定的词或短语(简单术语)
- A word or a phrase where the words begin with specified text (prefix term)
- 以指定的文本(前缀词)开头的词或短语
- Inflectional forms of a specific word (generation term)
- 特定词的屈折形式(代词)
- A word or phrase close to another word or phrase (proximity term)
- 靠近另一个词或短语的词或短语(接近词)
- Synonymous forms of a specific word (thesaurus)
- 特定词的同义形式(同义词典)
- Words or phrases using weighted values (weighted term)
- 使用加权值的词或短语(加权项)
I think "generation term" covers singular/plural.
我认为“世代术语”包含单数/复数。
#2
1
Possible solution for Plural and singular case is the comparison in of data in both way like below,
复数和单数情况的可能解是两种情况下的数据比较,
SELECT * FROM Item WHERE ItemName LIKE '%copiers%' OR 'copiers' LIKE '%'+ItemName+'%'
- First compares
ItemName LIKE '%copiers%'
to check ItemName is present in search string- 首先比较像'%复印机%'这样的项目名称,检查搜索字符串中出现的项目名称
- Second compares
'copiers' LIKE '%'+ItemName+'%'
checks the search string contains ItemName- 其次,比较“复制器”,如“%”+ItemName+“%”检查搜索字符串是否包含ItemName
In both way you will get possible correct result
用这两种方法你都能得到可能的正确结果
#1
3
You will need to set up Full Text Search
您需要设置全文搜索。
From that page:
从这个页面:
... queries can search for any of the following:
…查询可以搜索下列任何一种:
- One or more specific words or phrases (simple term)
- 一个或多个特定的词或短语(简单术语)
- A word or a phrase where the words begin with specified text (prefix term)
- 以指定的文本(前缀词)开头的词或短语
- Inflectional forms of a specific word (generation term)
- 特定词的屈折形式(代词)
- A word or phrase close to another word or phrase (proximity term)
- 靠近另一个词或短语的词或短语(接近词)
- Synonymous forms of a specific word (thesaurus)
- 特定词的同义形式(同义词典)
- Words or phrases using weighted values (weighted term)
- 使用加权值的词或短语(加权项)
I think "generation term" covers singular/plural.
我认为“世代术语”包含单数/复数。
#2
1
Possible solution for Plural and singular case is the comparison in of data in both way like below,
复数和单数情况的可能解是两种情况下的数据比较,
SELECT * FROM Item WHERE ItemName LIKE '%copiers%' OR 'copiers' LIKE '%'+ItemName+'%'
- First compares
ItemName LIKE '%copiers%'
to check ItemName is present in search string- 首先比较像'%复印机%'这样的项目名称,检查搜索字符串中出现的项目名称
- Second compares
'copiers' LIKE '%'+ItemName+'%'
checks the search string contains ItemName- 其次,比较“复制器”,如“%”+ItemName+“%”检查搜索字符串是否包含ItemName
In both way you will get possible correct result
用这两种方法你都能得到可能的正确结果