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

Template Usage - Sitecore

RSS
Modified on Thu, Jun 07, 2012, 1:57 PM by Administrator Categorized as Sitecore

Overview

This article describes a way to query your Sitecore database to determine where a template is used. These solutions may require the dbo.ItemTree view, available here.

Templates Used by a Template

declare
     @myTemplateID uniqueidentifier = 'CCB6DC31-DB14-47E3-902D-55B2C0767A71'
    
select 
    t.*
    
from 
    dbo.Fields f
    
    inner join dbo.ItemTree t
        on f.ItemId = t.ID
        
where 1=1
    and FieldId = '12C33F3F-86C5-43A5-AEB4-5598CEC45116'
    and Value like '%' + CONVERT(varchar(100), @myTemplateID) + '%'

Templates Used by a Site

select distinct 
    b.ItemPath
from 
    dbo.ItemTree a
    
    inner join dbo.ItemTree b
        on a.TemplateID = b.ID
where 1=1
    and a.ItemPath like '/sitecore/content/MySite%'
order by
    b.ItemPath

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