比如说
http://url/entity/678.htm   得到678http://url/entity/5.htm     5http://url/8.htm   得到8就是说后面的 数字+.htm是固定的

解决方案 »

  1.   

    select  reverse(substring(reverse(@s),charindex('.',reverse(@s))+1, charindex('/',reverse(@s))-charindex('.',reverse(@s))-1 ))
      

  2.   


    declare @t varchar(200)
    set @t = 'http://url/entity/678.htm' 
    set @t=substring(@t,
                                patindex('%[0-9]%',@t),
                                patindex('%[^0-9]%',   right(@t, len(@t)-patindex('%[0-9]%', @t)))
                               )
    select @t
      

  3.   

    select replace(stuff(@t,1,1+len(@t)-charindex('/',reverse(@t)),''),'.'+parsename(@t,1),'')
      

  4.   

    select right(parsename(@t,2),charindex('/',reverse(parsename(@t,2)))-1)
      

  5.   

    declare @t varchar(200)
    set @t='http://url/entity/678.htm'
    select reverse(substring(reverse(@t),5,charindex('/',reverse(@t))-5))