?
Solved

SQL Query to search for field containing specific email address

Posted on 2011-03-22
4
Medium Priority
?
312 Views
Last Modified: 2012-05-11
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...
0
Comment
Question by:Chris Millard
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 9

Accepted Solution

by:
Roman Gherman earned 2000 total points
ID: 35190974
SELECT *
FROM dbo.Faults
WHERE symptom2 like '%myEmail@dot.com%'

The replacement requires more thinking
0
 
LVL 9

Assisted Solution

by:Roman Gherman
Roman Gherman earned 2000 total points
ID: 35190998
And here is the replacement


Update dbo.Faults
Set    symptom2 = replace(symptom2 , 'myEmail@dot.com', 'myNEWEmail@dot.com')
0
 
LVL 17

Author Closing Comment

by:Chris Millard
ID: 35191009
Perfect - thanks ever so much...
0
 
LVL 8

Expert Comment

by:Kobe_Lenjou
ID: 35191013
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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is basically a blog post I wrote recently. I've found that SARGability is poorly understood, and since many people don't read blogs, I figured I'd post it here as an article. SARGable is an adjective in SQL that means that an item can be fou…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question