PDA

View Full Version : Query to Replace text with quotation marks in whole mysql database



Fli
03-20-2013, 09:13 PM
Hi, i would like to replace

[quote name='varioususernamesthere']

by

[quote name="varioususernamesthere"]

(single to double quotation marks)

in whole mysql database table.

Please what is the command to use?

Something like? UPDATE tablename SET "%[quote name="varioususernamesthere"]%" WHERE "%[quote name='varioususernamesthere']%";

Fli
08-08-2013, 01:16 PM
Here is how to replace string in mysql with quotation marks single and double. This command will replace partial string '] by "] in table TableName and column name ColumnName

update TableName set ColumnName = REPLACE(ColumnName, "']", '"]') WHERE ColumnName LIKE "%']%";

(Make sure you backup mysql first before runing this query)

This one may work if table is "post", in column "pagetext".:
update post set pagetext = REPLACE(pagetext, "']", '"]') WHERE pagetext LIKE "%']%";