Gossamer Forum
Home : General : Databases and SQL :

Replace certain charachters in ALL fields?

Quote Reply
Replace certain charachters in ALL fields?
Does anyone know if it is possible to replace all occurences of a charachter in all of the SQL database entries? For example;

a needs to be replaced with b in field 1, 2 3,4 and 5.
d needs to be replaced with c in field 1, 2 3,4 and 5.

I've had a look through the MySQL docs, but I'm a little lost. I understand the LIKE % stuff, but can't see if/how its possible to do what I'm looking for Unsure

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Replace certain charachters in ALL fields? In reply to
http://www.mysql.com/doc/en/String_functions.html#IDX1188
Quote Reply
Re: [Paul] Replace certain charachters in ALL fields? In reply to
I've read the part on;

REPLACE(str,from_str,to_str)
Returns the string str with all all occurrences of the string from_str replaced by the string to_str:
mysql> SELECT REPLACE('www.mysql.com', 'w', 'Ww');
-> 'WwWwWw.mysql.com'

However, they don't seem to say anywhere on that page how you would define the actual field. They use www.mysql.com as the example, but how would I set it to use a field etc? I'm a little confused with this function Unsure

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Replace certain charachters in ALL fields? In reply to
Search for REPLACE in the Links SQL forum - been discussed tons of times.

http://gossamer-threads.com/perl/gforum/gforum.cgi?do=search_results&search_forum=cat_5&search_string=REPLACE&search_type=AND&search_fields=sb&search_time=&search_user_username=&mh=50