This is not a solution in itself, as the comment is not really adequate.
Here is a recursive cte for the parent child relationship.
with DetailData as (
SELECT
'' ParentID,
'7419-01' DetailComponent,
0 DetailLevel
union all
SELECT '7419-01','44342-00',1 union all
SELECT '7419-01','45342-00',1 union all
SELECT '7419-01','46342-00',1 union all
SELECT '7419-01','47342-00',1 union all
SELECT '7419-01','48342-00',1 union all
SELECT '7419-01','49342-00',1 union all
SELECT '7419-01','50342-00',1 union all
SELECT '50342-00','51342-00',2 union all
SELECT '7419-01','52342-00',1 union all
SELECT '52342-00','54342-00',2 union all
SELECT '54342-00','54442-00',3 union all
SELECT '54342-00','54552-00',3 union all
SELECT '54552-00','R34S-54',4 union all
SELECT '54552-00','R123-54',4 union all
SELECT '54552-00','R111-54',4 union all
SELECT 'R111-54','R222-54',5 union all
SELECT 'R222-54','52342-00',6 union all
SELECT '7419-01','TEST34-00',1 union all
SELECT 'TEST34-00','445334-00',2 union all
SELECT '445334-00','52342-00',3 union all
SELECT '7419-01','1111-00',1 union all
SELECT '7419-01','1111-00',1 union all
SELECT '1111-00','52342-00',2
), DetailDataRecursive as (
select
ParentID,
DetailComponent,
DetailLevel
,
convert(varchar(max), DetailComponent) NameSpaceDetailComponent,
convert(varchar(max), row_number() over (partition by ParentID order by DetailComponent)) SortCode,
1 level
from DetailData
where ParentID = ''
union all
select
DetailDataChild.ParentID,
DetailDataChild.DetailComponent,
DetailDataChild.DetailLevel
,
DetailDataParent.NameSpaceDetailComponent + '.' + DetailDataChild.DetailComponent NameSpaceDetailComponent,
DetailDataParent.SortCode + '.' + convert(varchar(max), format(row_number() over (partition by DetailDataChild.ParentID order by DetailDataChild.DetailComponent), 'd4')),
level + 1 level
from DetailData DetailDataChild
inner join DetailDataRecursive DetailDataParent
on DetailDataChild.ParentID = DetailDataParent.DetailComponent
where DetailDataParent.level <= 10
)
select * from DetailDataRecursive
order by SortCode
;
From this query you should be able to see the parent child relationships in the NameSpaceDetailComponent column.
If this is correct and your expected result.
Then make a comment and I may be able to help some more.