• If I understand what you're looking for, it's actually pretty easy. Use a "not" pattern to exclude BCD.

    DECLARE @Text1 VARCHAR(8000);

    SELECT @Text1 = 'ABNAGENDRACSURENDRADJITHENDRAXNARENDRABVEERNDARAXDRMNDRAXRVINDRABNAGENDRACSURENDRADJITHEN';

    -- 111111111122222222222333333333444444444455555555556666666666777777777788888888889

    -- 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890

    SELECT StringPart = SUBSTRING(@Text1, PATINDEX('%A[^BCD]NARENDR%',@Text1),9)

    ,StringPartLocation = PATINDEX('%A[^BCD]NARENDR%',@Text1);

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