To find / identify a part of an original string and replace it with another string in a SQL query with MySQL, use REPLACE(), the string replace function.
For example, you may want to replace all spaces in one of the varchar or text fields to a single dash:
UPDATE `table` SET `old_field` = REPLACE(`old_field`, ' ', '-')
Or, you create a new column / field out of the old one and:
UPDATE `table` SET `new_field` = REPLACE(`old_field`, ' ', '-')
2 thoughts on “MySQL: Replace Substring with Another String – the MySQL String Replace Function”
i’m still waiting your help…
You may desire to place the output between and tags in order to preserve the formatting of the code. Please help e to complete this code :
var exclude_links = “http://”
Comments are closed.