Reputation: 781
What is the easiest way to delete a certain character in mysql. I need to delete the * character from a lot of rows.
Exp: Alviso (San Jose*)
I tried to look this up in google, but I don't really know what I am looking for.
Upvotes: 0
Views: 60
Reputation: 10781
http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_replace
The syntax is:
update [table_name] set [field_name] = replace([field_name],'[string_to_find]','[string_to_replace]');
Upvotes: 1
Reputation: 63970
This should do it:
update your_table
set your_column = replace(your_column,'*','')
Upvotes: 1
Reputation: 360066
Use the REPLACE()
string function, and an UPDATE
statement.
UPDATE my_table t
SET t.some_column = REPLACE(t.some_column, '*', '')
Upvotes: 2
Reputation: 22172
You can run a simple SQL like this:
UPDATE tableName
SET fieldName = REPLACE(fieldName, '*', '')
Upvotes: 3