我有View
我想在其中搜索一个字
如何在表的所有列中搜索单词?
SELECT *
FROM [Vw_FullTechInformation]
答案 0 :(得分:1)
您可以对所有列进行全文搜索
-- using contains
SELECT *
FROM [Vw_FullTechInformation]
WHERE CONTAINS(*, 'YourSearchText');
--using freetext
SELECT *
FROM [Vw_FullTechInformation]
WHERE FREETEXT(*, 'YourSearchText');
--using freetexttable
SELECT *
FROM FREETEXTTABLE([Vw_FullTechInformation],*,'YourSearchText')
但是您的表格/视图应该是全文索引,以使其正常工作。
答案 1 :(得分:0)
尝试,
firsttable 记录像这样
ID Value
1 First
2 Second
3 Third
4 FOUR
5 FIVE
6 six
SELECT * FROM firsttable
WHERE Value LIKE '%s'
OR Value LIKE 's%'
OR Value LIKE '%s'
OR Value LIKE '%s%' ;
**Output Like**
ID Value
1 First
2 Second
6 six