SELECT REVERSE(SUBSTRING(REVERSE(AURL),1,CHARINDEX('/',REVERSE(AURL))-1)) FROM TB

解决方案 »

  1.   

    DECLARE @S VARCHAR(200)
    SET @S = 'Pic/2009/1/200913051280669_S.jpg'
    SELECT REVERSE(SUBSTRING(REVERSE(@S),1,CHARINDEX('/',REVERSE(@S))-1))
      

  2.   


    declare @s varchar(400)
    set @s='Pic/2009/1/200913051280669_S.jpg'
    set @s=REVERSE(left(REVERSE(@s),charindex('/',REVERSE(@s))-1))
    print @s
      

  3.   

    declare @a table(url varchar(1000))
    insert @a
    select 'Pic/2009/1/200913051280669_S.jpg' union all
    select 'Pic/2009/11/200913051280669_S.jpg' union all
    select 'Pic/2009/2/200913051280669_S.jpg'update @a
     set url=stuff(url,1,charindex('/',url,10),'')select * from @a
    /*
    url
    -----------------------------------------------
    200913051280669_S.jpg
    200913051280669_S.jpg
    200913051280669_S.jpg
    */
      

  4.   

    select reverse(substring(reverse(aurl),1,charindex('/',reverse(aurl))-1))