Jasinski Technical Wiki

Navigation

Home Page
Index
All Pages

Quick Search
»
Advanced Search »

Contributor Links

Create a new Page
Administration
File Management
Login/Logout
Your Profile

Other Wiki Sections

Software

PoweredBy

Hierarchy of Items - Sitecore

RSS
Modified on Fri, Mar 09, 2012, 11:54 AM by Administrator Categorized as 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

ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.