2

我有一个名为 的表logs.lognotes,我想找到一种更快的方法来搜索备注中没有特定单词或短语的客户。我知道我可以使用“不喜欢”,但我的问题是,DOES NOT CONTAINS你可以用同样的方式替换不喜欢,就像你可以使用:

SELECT *
  FROM table
 WHERE CONTAINS (column, ‘searchword’)
4

2 回答 2

5

Yes, you should be able to use NOT on any boolean expression, as mentioned in the SQL Server Docs here. And, it would look something like this:

SELECT *
  FROM table
 WHERE NOT CONTAINS (column, ‘searchword’)

To search for records that do not contain the 'searchword' in the column. And, according to

Performance of like '%Query%' vs full text search CONTAINS query

this method should be faster than using LIKE with wildcards.

于 2013-09-16T20:07:43.693 回答
-1

你也可以简单地使用这个:

select * from tablename where not(columnname like '%value%')
于 2021-03-05T19:59:35.090 回答