This is a great feature of Oracle SQL, I'm sure many will find it useful.
I used to use it for getting the location hierarchy but we recently moved from Oracle SQL to SQL Server and I'm now struggling to achieve the same results.
I've got this far, but it's not quite right.
WITH HierarchyCTE(location, parent, path, systemid)AS
(SELECT location, parent, CAST(parent AS varchar(1024)), systemid
FROM lochierarchy
WHERE parent = 'CPP-390E' and systemid = 'PRIMARY'
UNION ALL
SELECT c.location, c.parent, CAST(p.path + ' \ ' + c.location AS varchar(1024)), c.systemid
FROM lochierarchy AS c INNER JOIN HierarchyCTE AS p ON c.parent = p.location WHERE c.systemid = 'PRIMARY' )
SELECT location, parent, path, systemid
FROM HierarchyCTE
I'd like to get to

But I'm getting

Hopefully someone might be able to help.
------------------------------
Richard White
------------------------------