FirstBorn Posted October 31, 2015 Share Posted October 31, 2015 How to Search Records in Table and Replace Characters?Hi,Thank you Very Much for your help!How do I search records in a table for specific quote character and replace it with a different quote character.(Windows / Website Compatible Font?)I know the basic SQL commands;SELECT * FROM `table` WHERE `body` ... blah blah blah,But how do I search inside the text record for:“ and replace them with this:"AND”replace with:"AND’replace with:'?Thank You VERY MUCH for Your Help!FirstBorn Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted October 31, 2015 Share Posted October 31, 2015 The function you're looking for happens to be called REPLACE(). So do an UPDATE query and chain as many REPLACE() calls as you need: UPDATE some_table SET some_column = REPLACE(REPLACE(REPLACE(some_column, '...', '...'), '...', '...'), '...', '...') ; I hope you're not doing this regularly? Quote Link to comment Share on other sites More sharing options...
Psycho Posted October 31, 2015 Share Posted October 31, 2015 I hope you're not doing this regularly? In other words, find the code that inserts those records and do the replacements on the text before the data is inserted. Once the problem has been fixed at the source, you can then run the necessary REPLACE queries to resolve the existing data. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.