how to look for an "enter" in a varchar

  • Hi all,

    An application was given to me that display in a grid several fields including a Desription field that is a varchar.

    The problem is that when I copy-paste the information that is in the grid to a MS. Excel sheet, when there is an enter in the Description field it moves the value of the field after the "enter" into the next row.

    I was thinking in using the Replace function, but don't know how to look for the "enter" char.

    Anybody who knows?

    Thanks.

    Kindest Regards,

    @puy Inc

  • Look for CHAR(13) carriage return or CHAR(10) line feed.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Didn't work, what I tried was:

    REPLACE(REPLACE(description, CHAR(13), ''), CHAR(10), '')

    Now is moving the info to the next column

    Kindest Regards,

    @puy Inc

  • Close, try this:

    Replace(REPLACE(REPLACE(description, CHAR(13), ''), CHAR(10), ''), CHAR(9), '')

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply