这是网址
www.abc.com/a/b/c/d/e/f/g/h/i
我想要这样的结果
www.abc.com/a/b/c/d/e/f/g/h/i
www.abc.com/a/b/c/d/e/f/g/h
www.abc.com/a/b/c/d/e/f/g
www.abc.com/a/b/c/d/e/f
www.abc.com/a/b/c/d/e
www.abc.com/a/b/c/d
www.abc.com/a/b/c
www.abc.com/a/b
www.abc.com/a
www.abc.com/
请看这段代码..
declare @length as int
declare @Totallength as int
declare @min as int
declare @strURL as varchar(max)
set @strURL='www.abc.com/a/b/c/d/e/f/g/h/i'
set @min=1
set @length=(SELECT LEN(@strURL) - LEN(REPLACE(@strURL, '/', '')))
set @Totallength=(select len(@strURL))
if(@length>1)
begin
while(@min<=@length)
begin
--select @strURL=left(@strURL,charindex('/',@strURL)-1)
SELECT @strURL = SUBSTRING( @strURL, CHARINDEX('/', @strURL) + 1, @Totallength)
print @strURL
set @min=@min+1
-- print @min
end
end