sql根据'/'截取最后的字符串

filpath字段值:/DataFile/UpLoad/Logo/NoPhoto.jpg

select filpath,REVERSE((SUBSTRING(REVERSE(FilPath),0,CHARINDEX('/',REVERSE(filpath)))))  from FileInfo

结果NoPhoto.jpg

1.SELECT REVERSE(filpath) FROM dbo.FileInfo

结果:gpj.otohPoN/ogoL/daoLpU/eliFataD/

2.SELECT CHARINDEX('/',REVERSE(filpath)) FROM dbo.FileInfo

结果:12

3.SELECT SUBSTRING(REVERSE(FilPath),0,CHARINDEX('/',REVERSE(filpath))) FROM dbo.FileInfo

结果:gpj.otohPoN

4.select REVERSE(SUBSTRING(REVERSE(FilPath),0,CHARINDEX('/',REVERSE(filpath))))  from FileInfo

结果:NoPhoto.jpg

bingo!

上一篇:API网关相关组件在业界的应用


下一篇:猜测未来微服务架构