Skip to content

Instantly share code, notes, and snippets.

@jknopp
Created August 28, 2023 16:26
Show Gist options
  • Save jknopp/f03b06e43a2b274ded2563dd303e3343 to your computer and use it in GitHub Desktop.
Save jknopp/f03b06e43a2b274ded2563dd303e3343 to your computer and use it in GitHub Desktop.
SQL Query that produces a list of items that directly or indirectly inherit from NavigableItemBase
WITH ClassHierarchy AS
(
--initialization
SELECT [ClassName], [ClassDisplayName], ClassID, ClassInheritsFromClassID
FROM CMS_Class
WHERE [ClassName] = 'ContentBase.NavigableItemBase'
UNION ALL
--recursive execution
SELECT e.ClassName, e.[ClassDisplayName], e.ClassID, e.ClassInheritsFromClassID
FROM CMS_Class e INNER JOIN ClassHierarchy m
ON e.ClassInheritsFromClassID = m.ClassID
)
SELECT [ClassName],[ClassDisplayName] FROM ClassHierarchy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment