Created
June 16, 2012 17:24
-
-
Save MikeRogers0/2942013 to your computer and use it in GitHub Desktop.
MySQL REPLACE function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REPLACE('Original String', 'Find This', 'Replace with this') | |
# So it can be used like: | |
SELECT REPLACE('My Original String', 'Original', 'Modified'); | |
# This will output: My Modified String | |
# So if you wanted to go through a full table and replace a bunch of strings, you could use it like this: | |
UPDATE `table_name` SET `field_name` = REPLACE(`field_name`, 'Find Me', 'Replace with Me'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment