Hierarchy of Items - Sitecore

with MyData as (
    select 
         ID
        ,Name
        ,ParentPath = CONVERT(varchar(max), '/')
        ,ItemPath   = convert(varchar(max), '/' + name)
    from 
        dbo.Items 
    where 1=1
        and ParentID = '00000000-0000-0000-0000-000000000000' 
    union all
    select
         i.ID
        ,i.Name
        ,ParentPath = d.ItemPath
        ,ItemPath   = convert(varchar(max), d.ItemPath + '/' + i.Name)
    from
        dbo.Items i
        inner join MyData d
            on d.ID = i.ParentID
)
select 
     ID
    ,ItemPath 
from 
    MyData 
order by 
    ItemPath