Hi,
Does anyone know how to split a url into it's component parts
using TSQL?
I can separate the url into it's root and document library (this is for SharePoint)
as follows
DECLARE @url varchar(100)
SET @url = 'http://ServerName/sites/MainSite/Subsite1/Subsite2/Shared Documents'
SELECT
@url as url,
LEFT(@url, LEN(@url) - CHARINDEX('/', REVERSE(@url)))as [root],
RIGHT(@url, CHARINDEX('/', REVERSE(@url))-1) as [doclib]
But how can I determine and split the subsite names when there is a variable number
of subsites. Preferably without creating a function?
I.E
Server Main Sub1 Sub2 etc
http://ServerName MainSite Subsite1
http://ServerName MainSite Subsite1 Subsite2
Thanks