Friday, September 16, 2011

how to delete newline character from table

How to delete new line character from mysql table? replace new line character from table
I was facing a small problem...I was uploading a textfile data to a mysql database...my line tarminator is '\n'. in my comma seprated textfile each recode is written in a new line that is newline character at the end of each line...when I upload the data using load data infile....systax with the last column new line character is also added....I wanted to remove newline character form the database....
here is the final solution for this:


update table set field=replace(replace(field, "\n", ""), '\r', '')

No comments:

Post a Comment