Solved

SQL Query to search for field containing specific email address

Posted on 2011-03-22
4
309 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 500 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 500 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

707 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