Search Email using CharIndex function

Rajnilari2015
Posted by Rajnilari2015 under Sql Server category on | Points: 40 | Views : 225
Suppose we have a table with the below values

DECLARE @T TABLE(Email VARCHAR(50))
INSERT INTO @T SELECT 'testing@yopmail.com' UNION ALL SELECT 'testing@gmail.com'


We want to list out only the yopmail's . The below TSQL Code will do so

SELECT *
FROM @T
WHERE CHARINDEX('yopmail',Email) > 0


/*
Email
-----------
testing@yopmail.com

*/

Comments or Responses

Login to post response