patindex problem

  • i have table column in sql server like this

    dat1/dat2/dat3/dat4/1/2009

    dat1/dat2/dat34/dat4/2/2009

    dat1/dat2/dat/sd34/dat4/3/2009

    ssf/sdf/sdf/sf/sf/sf/4/2009

    i want the number alone in that column like this

    1

    2

    3

    4

    please give me the solution

  • declare @result varchar(50)

    set @result = 'dat1/dat2/dat/sd34/dat4/3/2009'

    select @result = replace(right(@result,6),'/2009','')

    select @result

Viewing 2 posts - 1 through 1 (of 1 total)

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