当前位置: 代码迷 >> Sql Server >> sql怎么从表中提取路径的一部分
  详细解决方案

sql怎么从表中提取路径的一部分

热度:50   发布时间:2016-04-24 09:06:48.0
sql如何从表中提取路径的一部分?
提取图中红框部分

------解决思路----------------------
declare @str varchar(8000)
select @str=isnull(@str+',','')+substring(pt,LEN(pt)+2-charindex('/',reverse(pt)),charindex('.',pt)-LEN(pt)-2+charindex('/',reverse(pt))) from (select distinct pt from vc) as t
print @str 
  相关解决方案