Search code examples
sqlsql-serversql-like

Like Operator for checking multiple words


I'm struggling for a like operator which works for below example

Words could be

MS004 -- GTER   
MS006 -- ATLT   
MS009 -- STRR   
MS014 -- GTEE   
MS015 -- ATLT

What would be the like operator in Sql Server for pulling data which will contain words like ms004 and ATLT or any other combination like above.

I tried using multiple like for example

where column like '%ms004 | atl%' 

but it didn't work.

EDIT

Result should be combination of both words only.


Solution

  • Seems you are looking for this.

    `where column like '%ms004%' or column like '%atl%'`
    

    or this

    `where column like '%ms004%atl%'