x

Updating 1/2 of column?

Good day,

I am trying to clean up some data from a previous SQL database. I have a column that contains email addressed for employees. There are around 1200 employees. The domain name recently changed for the email address and I need to change just the @anywhere.net portion of the email address.

Is there a way to globally change all of the @anywhere.net to @thisplace.gov? Would it be easier to add a new column with the @thisplace.gov contained within? That however, doesn't solve the problem of still needing to globally change all 1200 email addresses in the email column... Any hints?

Tom

more ▼

asked Nov 18, 2009 at 08:36 PM in Default

Tom 1 gravatar image

Tom 1
31 1 1 1

Tom: any chance of you accepting this as the answer?
Dec 04, 2009 at 06:13 AM Kev Riley ♦♦
(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first
update EmployeeTable
set email = replace(email, '@anywhere.net','@thisplace.gov')

If you want to see the results before the update runs try

select  email,  replace(email, '@anywhere.net','@thisplace.gov') from EmployeeTable 
more ▼

answered Nov 18, 2009 at 08:41 PM

Kev Riley gravatar image

Kev Riley ♦♦
53k 47 49 76

Kev , excellent thank you
Sep 27, 2011 at 02:21 AM mickyd
(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x131
x46

asked: Nov 18, 2009 at 08:36 PM

Seen: 1145 times

Last Updated: Nov 18, 2009 at 08:36 PM