Published Tuesday 7th January 2014
I often find myself looking for this quick snippet of SQL code, even though I use it pretty much weekly. So, partly for my own reference, here's a quick line of SQL to find and replace any string of text in a single field throughout an entire database table.
UPDATE tblName SET fldName = REPLACE(fldName,'text to look for','replacement text');
Swap out the tblName reference for your table name, the fldName references for the field you want to make the replacement in, and the text to look for and replacement text values for your find and replace strings. REPLACE() is a case-sensitive MySQL function.
Blog posts are written by individuals and do not necessarily depict the opinions or beliefs of QWeb Ltd or its current employees. Any information provided here might be biased or subjective, and might become out of date.
Nobody has commented yet.
Your email address is used to notify you of new comments to this thread, and also to pull your Gravatar image. Your name, email address, and message are stored as encrypted text. You won't be added to any mailing list, and your details won't be shared with any third party.