SQL Command for removing characters like '!' or '*' from data in a MySQL column
I suspect this to be a relatively easy fix for someone with a greater grasp on SQL.
Some of the data in the 'Name' field of my db have a '!' or '*' in the name, usually at the beginning of the name. I want to remove those unnecessary characters.
Is there an SQL command that will achieve such a lofty goal with alacrity and simplicity?
Thanks in advance.
UPDATE tablename SET Name = REPLACE(Name, '!', ''); UPDATE tablename SET Name = REPLACE(Name, '*', '');
To do it in a single query, you can use this:
UPDATE tablename SET Name = REPLACE(REPLACE(Name, '*', ''), '!', '');