You want to change any occurrences of [EMAIL PROTECTED] to [EMAIL PROTECTED] in column emailaddress, right? Assuming your table is named 'mytable', it looks to me like you could use
UPDATE mytable SET emailaddress=REPLACE(emailaddress,'@home.com','@comcast.net'); See <http://www.mysql.com/doc/S/t/String_functions.html> for string function documentation. Note that 'comcast.net' is 3 chars longer than 'home.com'. I mention that only because if length('[EMAIL PROTECTED]') + 3 is greater than the length of the emailaddress column, the extra will be lopped off at the end in this update. I don't imagine that will be a problem, though. Michael On Fri, 4 Jan 2002, Robert Lucier wrote: > I don't think you can do it with a single command. One fairly easy way > is to run a command to generate the sql that will do the update. So > your first statement will be something like: > > select concat( 'update <mytable> > set emailaddress=''', emailaddress, > '''where <primary_key_column>=', > <primary_key_column) > > substituting <mytable> and <primary_key_column> with your values. > Output the results of that query to a file. Use your favorite text > editor to do the actual replacement of the email address domain. Use > mysql to run that file as a sql script. Update complete. > > --- Greg Peretti <[EMAIL PROTECTED]> wrote: > > I have what I hope is a simple problem, but being somewhat a novice > > at > > MySQL, it is a bit beyond me. > > > > I have a database that has a emailaddress field. A large number of > > the > > entries are from home.com, Excite's ISP. Since Excite is out of > > business, Comcast is converting them all to comcast.net next month. > > > > Is there a simple way to change all home.coms to comcast.nets while > > retaining the front part of each email address in our database? > > > > A link to the pertinent section of the manual would be most helpful. > > > > -- > > > > Greg Peretti > > web developer > > www.abqjournal.com > > (505) 823-3888 > > Michael Stassen University Information Technology Services Indiana University Bloomington [EMAIL PROTECTED] --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php