skyline01
skyline01

Reputation: 2089

Does not contain query

I'm working in SQL Server 2008. I am trying to run a "does not contain" query. My basic syntax is:

SELECT
*
FROM some_table
WHERE
some_column <> '%some_text%'

I would expect this to return all records that do not contain the text "some_text" anywhere in the some_column string. However, the actual result set is returning records that do contain "some_text" somewhere in the string. What am I doing wrong?

Upvotes: 2

Views: 11110

Answers (1)

nitishagar
nitishagar

Reputation: 9403

Can you try:

SELECT
*
FROM some_table
WHERE
some_column NOT LIKE '%some_text%'

Upvotes: 7

Related Questions