• probably very similar, using reverse and patindex for the first non numeric character: from there, for the 1/-1, a case based on the len() would be what i would use.

    with tmp as (

    select x = 'some text-1'

    union select x = 'some text-123'

    union select x = 'some text-123.4'

    union select x = 'some text 123'

    union select x = 'some text-'

    union select x = 'some text'

    union select x = 'some text-xyz'

    )

    select x,REVERSE(SUBSTRING(REVERSE(x),0,PATINDEX('%[^0-9]%',REVERSE(x))))

    FROM tmp

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!