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

avatar image

Tom 1
31 1 1 3

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

avatar image

Kev Riley ♦♦
63.8k 48 61 81

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.

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:

x161
x41

asked: Nov 18, 2009 at 08:36 PM

Seen: 1334 times

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

Copyright 2016 Redgate Software. Privacy Policy