Home Gitesh Portfolio Blog About Me Gallery Contact

Sitecore: Find items with uppercase URLs

Sitecore: Find items with uppercase URLs.

 

WITH ItemsTable (ItemPath, ID, Name, TemplateID, MasterID, ParentID, Created, Updated)
    AS
    (
        SELECT CAST('/' + base.Name AS nvarchar(MAX)) as ItemPath,
            base.ID, base.Name, base.TemplateID, base.MasterID, base.ParentID, base.Created, base.Updated
			
        FROM Items as base
        WHERE base.ID = '11111111-1111-1111-1111-111111111111'	
 
        UNION ALL
	
        SELECT CAST(ItemPath + '/' + child.Name AS nvarchar(MAX)),
            child.ID, child.Name, child.TemplateID, child.MasterID, child.ParentID, child.Created, child.Updated
			
        FROM ItemsTable as parent 
        INNER JOIN Items as child 
            ON child.ParentID = parent.ID 
    )	
    SELECT RIGHT(ItemsTable.ItemPath, LEN(ItemsTable.ItemPath) - 30), ItemsTable.ItemPath, ItemsTable.ID, ItemsTable.Name, ItemsTable.TemplateID, Created
    FROM ItemsTable
	where
	cast(Replace(ItemsTable.ItemPath, '/sitecore/content/projectName/Home/Home','') as varbinary(120)) != cast(lower(Replace(ItemsTable.ItemPath, '/sitecore/content/projectName/Home/Home', '')) as varbinary(120))
	and 
	ItemsTable.ItemPath LIKE '/sitecore/content/projectName/Home/Home/%'

Posted: 12/02/2023 8:45:58 p.m. by Gitesh Shah | with 0 comments