Reputation: 662
I have some rows ( > 50.000) in my database which contains columns with strings + '\n'. I mean the records looks like this:
abcd\n or \nabcd
Because of that sometimes my application does not work correctly. My question is: How could i update this rows with the correct value and eliminate '\n' spaces besides going to every row and update it manually ?
Upvotes: 0
Views: 68
Reputation: 3469
Have you tried this?
UPDATE table SET column=REPLACE(column,'\\n','') WHERE column LIKE '%\\n' OR column LIKE '\\n%'
If you don't know where the new line is, simply:
UPDATE table SET column=REPLACE(column,'\\n','')
Upvotes: 0
Reputation: 204844
update your_table set somecolumn = replace(somecolumn, '\n', '')
Upvotes: 1