Definately looks like a job for a recursive CTE in order to build the Path then a simple update after, this is a simple test rig for a select, but the update isnt too bad.
drop table #hirNode
go
Create Table #hirNode(
hirNode Int
,hirNodeParent int
,Title varchar(100)
)
Insert into #hirNode
values (1,NULL,'Start')
,(2,1,'Second')
,(3,2,'Third')
,(4,NULL,'Start2')
,(5,4,'Second2');
WITH BuildPath(hirNode,hirNodeParent, NodeLevel, NodePath)
AS (SELECT hirNode,
hirNodeParent,
1,
CONVERT(varchar(255), '\\'+Title)
FROM #hirNode
WHERE hirNodeParent IS NULL --Start at the Top
UNION ALL
SELECT
h.hirNode,
h.hirNodeParent,
NodeLevel + 1,
CONVERT (varchar(255), RTRIM(NodePath) + '\' + Title)
FROM #hirNode AS h
JOIN BuildPath AS p ON h.hirNodeParent = p.hirNode
)
Select * from BuildPath
The output for NodePath is
\\Start
\\Start\Second
\\Start\Second\Third
\\Start2
\\Start2\Second2
It might need ordering but its just an example, is that what you are looking for?
_________________________________________________________________________
SSC Guide to Posting and Best Practices