Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2012
    Posts
    9

    Unanswered: How can I eliminate new line character from a field?

    I have a new line character in a field and i try to display the field in the correct form (that means without enter) using the following command, but doesn't work. Could anyone to help me? Thanks!

    select field_name
    ,trim(trailing '\n' from field_name)
    from table_name

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    rather than trim I'd suggest using replace
    MySQL :: MySQL 5.5 Reference Manual :: 12.5 String Functions
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Apr 2012
    Posts
    9
    Quote Originally Posted by healdem View Post
    rather than trim I'd suggest using replace
    MySQL :: MySQL 5.5 Reference Manual :: 12.5 String Functions
    I've tried also with replace but, the same result
    I'm thinking maybe the special character '\n' is not the good one for "enter"?

  4. #4
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483

  5. #5
    Join Date
    Sep 2009
    Location
    San Sebastian, Spain
    Posts
    880
    The character '\n' is used for linefeed. However, you should note that newlines in Linux are represented with just the line feed character '\n'. In MS DOS a new line is represented by two characters carriage return ('\r') and line feed ('\n'). Could it be that you have both carriage returns and line feeds?
    Ronan Cashell
    Certified Oracle DBA/Certified MySQL Expert (DBA & Cluster DBA)
    http://www.it-iss.com
    Follow me on Twitter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •