search string sql query code example
Example 1: sql where contains
SELECT * FROM mytable
WHERE column1 LIKE '%word1%'
OR column1 LIKE '%word2%'
OR column1 LIKE '%word3%'
Example 2: locate sql server
SELECT CHARINDEX('b','ab') //returns 2
SELECT * FROM mytable
WHERE column1 LIKE '%word1%'
OR column1 LIKE '%word2%'
OR column1 LIKE '%word3%'
SELECT CHARINDEX('b','ab') //returns 2