Semi colons

  • How can I remove the last semi colon from the list of names that gets created?

    I want the semi colons between the names, just not at the end of the list.

    SELECT LTRIM(ISNULL(RM.FIRST_NAME,'')+ ' ' + ISNULL(RM.LAST_NAME,'')+'; '

  • I think we need more info. Your code here will just concatenate a first and last name. In a query, you'll get one row per record, not a list. The only reason you'll have a semi-colon is because you put it there.

    Are you using this in some sort of recursive query to create a long, concatenated string from multiple records? If so, please give us a little more of the code you've already put together that better illustrates the issue.

    Rob Schripsema
    Propack, Inc.

  • That could work but it's just a guess with the info you supplied.

    LEFT(@Str, LEN(@Str) - 1)

  • That did it!!

    Thanks Ninja's_RGR'us

  • krypto69 (4/16/2010)


    How can I remove the last semi colon from the list of names that gets created?

    I want the semi colons between the names, just not at the end of the list.

    SELECT LTRIM(ISNULL(RM.FIRST_NAME,'')+ ' ' + ISNULL(RM.LAST_NAME,'')+'; '

    Post te code that creates the list of names because THAT's where this problem should be resolved.

    --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)

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

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