I found something very handy today, search and replace on Mysql databases. You can do it on phpmyadmin or make a php script with this.
After moving a wordpress site from server I discovered that all image links were broken because they are placed directly inside each post. They were still linking to the old server. Changing it manually would be a nightmare.
Luckily MySql is your friend. To search and replace a text string, start up phpMyAdmin, and click on your database name that you want to run the search and replace through. At the top of the window, click on the “SQL” tab.
In the text box, enter the following code.
UPDATE tablename SET FIELD = REPLACE(FIELD,"findstring","replacestring")
Works like a charm.