SQL函数

1:截取字符串的函数

19b195ab-f293-45c1-9353-d31f18592ed2.jpg
declare @str1 varchar(500)
set @str1='http://xxxx.xxxxx.cn:58002/Uploads/Disease/2020-12-08/040de12a-a2e0-4936-b29c-d8ad769b4946/19b195ab-f293-45c1-9353-d31f18592ed2.jpg'
select REVERSE(SUBSTRING(REVERSE(@str1),1,CHARINDEX('/',REVERSE(@str1))-1))

  

   .jpg

declare @str2 varchar(500)
set @str2='19b195.ab-f293-.45c1-9353-d31f18592ed2.jpg'
select REVERSE(SUBSTRING(REVERSE(@str2),1,CHARINDEX('.',REVERSE(@str2))))

  

 

posted @ 2021-01-25 10:48  HongEgg  阅读(65)  评论(0编辑  收藏  举报