Yes. There must be several, here is one of them:
You can use the function REPLACE
(not to be confused with the commando REPLACE
) no update. It will return you the complete original string, only with the searched part replaced.
Thus:
UPDATE produtos
SET product_params = REPLACE(product_params, 'max_order_level=""', 'max_order_level="1"')
WHERE product_params LIKE '%max_order_level=""%'
The only restriction would be that the product has this parameter set as you expect (max_order_level=""
), only to reduce the amount of records affected to those that will be effectively affected.
See this example working on sql fiddle.
What is the type of column?
– Woss
she is varchar(255)
– Leandro Marzullo
Update product set max_order_level="1"; if you want to do this on all products in the table you do not need Where.
– lpFranz