Get everything after and before certain character in SQL Server

前端 未结 15 1954
臣服心动
臣服心动 2020-12-07 18:48

I got the following entry in my database:

images/test.jpg

I want to trim the entry so I get: test

So basically, I want

15条回答
  •  不知归路
    2020-12-07 19:09

    You can try this:

    Declare @test varchar(100)='images/test.jpg'
    Select REPLACE(RIGHT(@test,charindex('/',reverse(@test))-1),'.jpg','')
    

提交回复
热议问题