1

I have \n in my database after importing from Mysql. How can I replace '\n' to be a real new line?

I tried

UPDATE table SET column = replace(column, '\n', "\n")

in several variations but without success.

Qiao
  • 16,565
  • 29
  • 90
  • 117
  • similar question: [New Line character \n in SQLite concatenate](http://stackoverflow.com/questions/23930865/new-line-character-n-in-sqlite-concatenate) – CL. Jun 29 '14 at 07:59

2 Answers2

2
UPDATE cy_prod SET text = replace(text, '\n', '
')

made the trick

Qiao
  • 16,565
  • 29
  • 90
  • 117
0

Another option:

UPDATE table SET column = replace(column, '\n', char(10));

ASCII char code 10 is the UNIX newline character.

oelna
  • 2,210
  • 3
  • 22
  • 40