0

I need to fix some (bad) inserted data in DB, I had data inserted with single qoutes like: ('love')

I want to move this to (love), without effect on something like (we're),

info table (structure)

id     text
1     'love'
2     'man'
3     we're..
4     John
5     'Sarah'

I want to fix "info" table to be:

info table (structure)

id     text
1      love
2      man
3      we're..
4      John
5      Sarah

I can select this data using:

select * from info where text like "'%'"

thanks,

mwafi
  • 3,946
  • 8
  • 56
  • 83
  • want to remove single quotes, if data inserted inside it – mwafi Feb 18 '15 at 09:01
  • possible duplicate of [Insert a value containg single quotes in MySQL](http://stackoverflow.com/questions/887036/insert-a-value-containg-single-quotes-in-mysql) – Mark Feb 18 '15 at 09:02
  • @ChristianMark I need to fix already inserted data – mwafi Feb 18 '15 at 09:04

2 Answers2

3

try this untested query:

update info set text = replace(text,"'","") where text like "'%'"

Jens
  • 67,715
  • 15
  • 98
  • 113
  • Even this is working on MySQL, don't use `"` for string. It will fail on every other, standard compatible system. – frlan Feb 18 '15 at 09:25
0

You can use this statement to update all the rows of the table.

update Table_Name
set ColumnName= REPLACE(ColumnName,'''','')
where ColumnName LIKE ('''%''')