Apr
6
2010
MySQL: Mass email change
Author: Jeremy SmythIt’s not unheard of for a company to change e-mail domain in mid-thrust; maybe it’s been bought out, or rebranded, or the parent company has spun it off to its own brand.
Only you’ve got hundreds of employees, each one with their own email address, and your MySQL database is in dire need of updating to reflect this.
To get around this, you’ll need to replace the relevant part of each email string within an update statement, grabbing the hostname substring (after the ‘@’) with a REPLACE, and replacing it.
Note: REPLACE() is case-sensitive, so if needs be, you can use LOWER(email) inside the REPLACE function if you need to catch all case possibilities, as below:
This will also convert all your email addresses to lowercase, so be aware of that.
Tags: MySQL
July 21st, 2011 at 07:26
Do you write your own article or not, if yes you do know what you’re doing, keep on the great job, oh and you might write some PDFs.
July 31st, 2011 at 10:33
74. Excellent read, I just passed this onto a friend who was doing a little research on that. And he just bought me lunch as I found it for him smile So let me rephrase that: Thank you for lunch!
November 24th, 2011 at 12:19
Data Conversion …
[...]just below, are some totally unrelated sites to ours, however, they are definitely …