question

Tom 1 avatar image
Tom 1 asked

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

updatedata
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Kev Riley avatar image Kev Riley ♦♦ commented ·
Tom: any chance of you accepting this as the answer?
0 Likes 0 ·

1 Answer

·
Kev Riley avatar image
Kev Riley answered
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
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

mickyd avatar image mickyd commented ·
Kev , excellent thank you
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.