Answers for "sql if contains"

SQL
5

check if string contains substring sql

Declare @mainString nvarchar(100)='Amit Kumar Yadav'  
---Check here @mainString contains Amit or not, if it contains then retrun greater than 0 then print Find otherwise Not Find  
if CHARINDEX('Amit',@mainString) > 0   
begin  
   select 'Find' As Result  
end  
else  
    select 'Not Find' As Result
Posted by: Guest on May-28-2020
14

sql where contains

SELECT * FROM mytable
WHERE column1 LIKE '%word1%'
   OR column1 LIKE '%word2%'
   OR column1 LIKE '%word3%'
Posted by: Guest on January-22-2020
0

sql where contains part of string

-- To find an exact string
SELECT * FROM [table] WHERE [field] LIKE '%stringtosearchfor%'.
Posted by: Guest on October-14-2020
0

sql table contains

IF (SELECT COUNT(*) FROM foos WHERE bar = 'baz') > 0
Posted by: Guest on April-13-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language