• You're on target Luis. It's a CHARINDEX and right command usage confusion.

    OP, let's say you have this:

    1234|1234567890

    CHARINDEX (|) will = 5.

    When you RIGHT(string,5) you get 67890.

    What you need to do is RIGHT( string, LEN(string) - CHARINDEX()) to get to the correct # of characters, or use REVERSE() like Luis did above.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA