mysql how to replace part of a string that contains quotes -


i have table field called "params" values (they different 2 names below same):

{"lots_of_stuff,"frameborder":"0",lots_of_stuff,"pageclass_sfx":"",lots_of_stuff} 

i need script change "frameborder":"0" "frameborder":"1" , "pageclass_sfx":"" "pageclass_sfx":"1".

please note not fields in params have this.

you can use mysql's replace function:

update tbl set value = replace(replace(value, 'pageclass_sfx":""', 'pageclass_sfx":"1"'), 'frameborder":"0', 'frameborder":"1') 

result

|                                                                              value | -------------------------------------------------------------------------------------- | {"lots_of_stuff,"frameborder":"1",lots_of_stuff,"pageclass_sfx":"1",lots_of_stuff} |

see demo


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -