SQL Query to search for field containing specific email address

I need a query to search for a specific email address in a table called "dbo.Faults", in a column called "symptom2". The email address is only part of the "symptom2" column. The symptom2 column is set to (ntext,null)

How do I write this query?

AND (if it's easy enough to do) can I search for the email address and replace it with another?

Thanks...
LVL 17
Chris MillardAsked:
Who is Participating?
 
Roman GhermanConnect With a Mentor Senior Software EngineerCommented:
SELECT *
FROM dbo.Faults
WHERE symptom2 like '%myEmail@dot.com%'

The replacement requires more thinking
0
 
Roman GhermanConnect With a Mentor Senior Software EngineerCommented:
And here is the replacement


Update dbo.Faults
Set    symptom2 = replace(symptom2 , 'myEmail@dot.com', 'myNEWEmail@dot.com')
0
 
Chris MillardAuthor Commented:
Perfect - thanks ever so much...
0
 
Kobe_LenjouCommented:
And combined (to be a bit friendly to SQL Server):

Update dbo.Faults
Set    symptom2 = replace(symptom2 , 'myEmail@dot.com', 'myNEWEmail@dot.com')
WHERE symptom2 like '%myEmail@dot.com%'
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.