CodeMonkey
CodeMonkey

Reputation: 2295

Error updating mysql table's column

I messed up one of the columns of my database while url encoding the input. Now all the spaces are replced by a "+" sign.

I tried updating the DB using the following query but it throws me error

UPDATE tableName SET 'columnName' = REPLACE('columnName','+',' ')";

Error i am getting is :

Unknown column 'columnName' in 'field list'

Upvotes: 0

Views: 24

Answers (2)

Kirk
Kirk

Reputation: 5077

Do not use quote mark for column name, Try this

 UPDATE tableName SET columnName = REPLACE(columnName,'+',' ');

Upvotes: 1

Krish R
Krish R

Reputation: 22711

Try this, Remove single quote wrapped around the column name

UPDATE tableName SET `columnName` = REPLACE(`columnName`,'+',' ')";

Upvotes: 1

Related Questions