August 13th, 2000, 06:12 PM
I have a table called 'sample' with five fields in it. In one of the fields called 'email' I have data with lots of entries which looks like ****@hotmail.com,firstname.lastname@example.org.
I need to replace the "hotmail.com" with "webmail.com" without manually editing the whole table.
Can i do it with any commands in MySQL.
or are there any functions to use and change it.
thanks for the help.
P.S..I am a beginner in SQL.
August 13th, 2000, 07:08 PM
I would make a script that makes the change... If you have access to Perl,Asp or PHP. I don't know if you can do it only using mysql
August 13th, 2000, 07:29 PM
I need to try to make it work without using the script and I was wondering if there are any append kinda functions in MySQL.
I appreciate ur responses!
August 13th, 2000, 07:35 PM
I am pretty sure u can't do it
August 13th, 2000, 07:44 PM
you usually use:
update sample set email@example.com' where mail like '%hotmail.com';
But in this example you change all e-mail adresses containing hotmail.com in the end to an adress called firstname.lastname@example.org.
I try figure something out, but it is late now and i will go to bed. Tomorrow i'll find out a solution.
By the way, I can easily(how do you spell that) make that script for you if you want...
August 13th, 2000, 08:26 PM
hey thanks gooky!
I appreciate it.
August 14th, 2000, 03:44 AM
update sample set email = concat(substring(email, 1, instr(email, '@')), 'webmail.com');
Nothing is impossible in SQL!
August 14th, 2000, 04:32 AM
August 14th, 2000, 04:58 AM
I am amazed....hey u guys just drawn me into this field..gimme some pointers as to where I could find and master this stuff.