aeris130 Posted May 1, 2007 Share Posted May 1, 2007 I would like to check every column in every table in my entire MySQL-database. Whenever the string of text "http://www.myurl.com/web" is located inside a column (even though there may be other content there as well), I'd like to replace it (i.e update the column) with "http://www.myurl.com", and leave the rest of said columns text/data as it is. Can this be done using a single SQL-syntax? Link to comment https://forums.phpfreaks.com/topic/49446-updating-several-columns-in-several-tables/ Share on other sites More sharing options...
fenway Posted May 1, 2007 Share Posted May 1, 2007 Nope -- there is no "multi-column" approach. Link to comment https://forums.phpfreaks.com/topic/49446-updating-several-columns-in-several-tables/#findComment-242455 Share on other sites More sharing options...
aeris130 Posted May 1, 2007 Author Share Posted May 1, 2007 Would it be possible to specify a single column in a single table, and only edit/update the string "http://www.myurl.com/web" if it's present (without having to update the entire column, thus leaving the remaining content as-is)? Or do I have to redefine the entire content in the column through some sort of script? Link to comment https://forums.phpfreaks.com/topic/49446-updating-several-columns-in-several-tables/#findComment-242706 Share on other sites More sharing options...
fenway Posted May 1, 2007 Share Posted May 1, 2007 You can run REPLACE() on any given column. Link to comment https://forums.phpfreaks.com/topic/49446-updating-several-columns-in-several-tables/#findComment-242867 Share on other sites More sharing options...
bubblegum.anarchy Posted May 2, 2007 Share Posted May 2, 2007 A procedural trigger may be appropriate if you have access to the mysql 5.1 Link to comment https://forums.phpfreaks.com/topic/49446-updating-several-columns-in-several-tables/#findComment-243080 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.