Return rows that do not contain certain text

时间:2022-09-23 13:10:40

I have a query in SQL Server to select all the data from a database.

我在SQL Server中有一个查询来从数据库中选择所有数据。

SELECT * FROM DatabaseName

Is there a way to select all the data that does not contain a certain phrase.

有没有办法选择不包含某个短语的所有数据。

For example if I have a table that contains

例如,如果我有一个包含的表

Contain
Contain1
Contain2
Exclude1
Exclude2
Contain3
Contain4
Exclude3

and I want to exclude the text Exclude

我想排除文本排除

it would only return

它只会回来

Contain
Contain1
Contain2
Contain3
Contain4

Unfortunately every row is very large (>500000 characters) so I am trying to find an efficient way to do this.

不幸的是,每一行都非常大(> 500000个字符),所以我试图找到一种有效的方法来做到这一点。

2 个解决方案

#1


-1  

SELECT *
FROM YourTable
WHERE [Column] NOT LIKE 'Exclude%'

#2


2  

This looks like you might benefit from a FULLTEXT INDEX.

看起来您可能会受益于FULLTEXT INDEX。

#1


-1  

SELECT *
FROM YourTable
WHERE [Column] NOT LIKE 'Exclude%'

#2


2  

This looks like you might benefit from a FULLTEXT INDEX.

看起来您可能会受益于FULLTEXT INDEX。