• Luis Cazares (7/2/2013)


    What are you trying to do? It seems to me that you want either one of these options.

    Without sample data and expected results there's hard to know.

    Select LEFT(FT.DESCAR,CHARINDEX('|',FT.DESCAR)-1) from FT

    where ftstamp = 'jm13070255373,181882981'

    Select RIGHT(FT.DESCAR,CHARINDEX('|',REVERSE(FT.DESCAR))-1) from FT

    where ftstamp = 'jm13070255373,181882981'

    Just to share a trick for these "right splits"... you don't need the expense of a REVERSE.

    Select SUBSTRING(FT.DESCAR,CHARINDEX('|',FT.DESCAR)+1,8000) from FT

    where ftstamp = 'jm13070255373,181882981';

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