954,560 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Replace String

Does anyone know the SQL statement for replacing a string in the whole of a database.
My database is called DB1 and I want to remove any instance of "Table/".

Many Thanks,

felix001
Junior Poster in Training
65 posts since Dec 2010
Reputation Points: 23
Solved Threads: 0
 

You can
a) use an interface like Navicat which is capable of global search/replace operations;
b) dump the whole database to a file, replace the string on the file and reload it into the database.
To the best of my knowledge there is no mysql function which does what you wish.

smantscheff
Nearly a Posting Virtuoso
1,233 posts since Oct 2010
Reputation Points: 300
Solved Threads: 254
 

Thanks all. In the end I used the following commands,

=====
UPDATE jos_sh404sef_aliases
SET oldurl = REPLACE(oldurl, "Table/", "")
=====

felix001
Junior Poster in Training
65 posts since Dec 2010
Reputation Points: 23
Solved Threads: 0
 

So you weren't looking for a global search/replace but only for the standard replace function applied to a specific column in a specific table - which is quite another task.

smantscheff
Nearly a Posting Virtuoso
1,233 posts since Oct 2010
Reputation Points: 300
Solved Threads: 254
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You