:::: MENU ::::

To Find the Package or Task sequence Folder Hive -SQL Query

WITHfolderHierarchy(ContainerNodeID,Name,ObjectType,ParentContainerNodeID,[Path])

AS(SELECTContainerNodeID,Name,ObjectType,ParentContainerNodeID,CAST(‘/’+[Name]+‘/’ASVARCHAR(MAX))AS[Path]

FROMdbo.FoldersWHEREParentContainerNodeID= 0

UNIONALL

SELECTchild.ContainerNodeID,child.Name,child.ObjectType,child.ParentContainerNodeID,parent.[Path]+child.[Name]+‘/’AS[Path]

FROMdbo.FoldersASchild

INNERJOINfolderHierarchyASparent

ONparent.ContainerNodeID=child.ParentContainerNodeID)

SELECTdistinctfldr.[Path],mbr.InstanceKeyASPackageID,pkg.Name

FROMfolderHierarchyASfldr

INNERJOINdbo.FolderMembersASmbrONfldr.ContainerNodeID=mbr.ContainerNodeID

INNERJOINdbo.v_packageASpkgONpkg.PackageID=mbr.InstanceKey

WHEREpkg.Namein(‘Packagename’)


So, what do you think ?