Check if string doesn't contain another string

前端 未结 4 1864
闹比i
闹比i 2021-02-02 05:11

In T-SQL, how would you check if a string doesn\'t contain another string?

I have an nvarchar which could be \"Oranges Apples\".

I would like to do

4条回答
  •  你的背包
    2021-02-02 05:54

    The answers you got assumed static text to compare against. If you want to compare against another column (say, you're joining two tables, and want to find ones where a column from one table is part of a column from another table), you can do this

    WHERE NOT (someColumn LIKE '%' || someOtherColumn || '%')
    

提交回复
热议问题