Home Features Pricing Support Contact
Search:     Advanced search

How can I do a mass find and replace in articles?

Article ID: 189
Last updated: 18 Dec, 2010

You can write one-line find-and-replace statements in SQL.
To find a string in a certain field and replace it with another string:

UPDATE [table_name] SET [field_name] = REPLACE([field_name],'[string_to_find]','[string_to_replace]');


To not affect date updated for the articles use following sql:

UPDATE [table_name] SET [field_name] = REPLACE([field_name],'[string_to_find]','[string_to_replace]'), date_updated=date_updated;


To find what articles will be affected:

SELECT [field] FROM [table_name] WHERE [field_name] LIKE '%[string_to_find]%';


Example: replace "apple" to "banana" in all articles

UPDATE kbp_kb_entry SET body = REPLACE(body,'apple','banana'), date_updated=date_updated;
Article ID: 189
Last updated: 18 Dec, 2010
Revision: 1
Views: 5748
Comments: 0
Print Export to PDF Subscribe Share Add comment
This article was:   Helpful | Not helpful
Prev   Next
Troubleshooting adding an image to an article     How can I set KBPublisher to use SSL?