Marcos27
asked on
SQL Statement to Update Email Domain
Hello Experts -
I need an SQL update statement to execute against a column in my 'user' table called 'email'. Right now, it contains similar emails for all of my users: mary.jones@blue.com, brian.hall@blue.com etc. The company (email domain) has just changed names to something entirely different, so they all need to now be mary.jones@white.com, brian.hall@white.com etc. The change is the same for everyone, two entirely unique company names, so, from @blue.com to @white.com.
Will this statement work? I'm on SQL 2008.
UPDATE user SET email = replace(email,'@blue.com', '@white.co m') WHERE email LIKE '%@blue.com';
I'm going to test and backup, but I just want to make sure the above function does what I think it's going to do. Any suggestions are helpful.
Thank you,
Marcos
I need an SQL update statement to execute against a column in my 'user' table called 'email'. Right now, it contains similar emails for all of my users: mary.jones@blue.com, brian.hall@blue.com etc. The company (email domain) has just changed names to something entirely different, so they all need to now be mary.jones@white.com, brian.hall@white.com etc. The change is the same for everyone, two entirely unique company names, so, from @blue.com to @white.com.
Will this statement work? I'm on SQL 2008.
UPDATE user SET email = replace(email,'@blue.com',
I'm going to test and backup, but I just want to make sure the above function does what I think it's going to do. Any suggestions are helpful.
Thank you,
Marcos
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Run it as a select statement first then see (you might want to limit the number of rows).
select replace(email,'@blue.com',