USE FileSys

WITH SubDirs (id,name) AS (
	SELECT ID,Name FROM Dirs WHERE ParentID = 2
	UNION ALL
	SELECT D.ID,D.Name 
      FROM Dirs D INNER JOIN SubDirs S ON D.ParentID = S.ID
)
SELECT * FROM SubDirs


SELECT ID,Name FROM Dirs WHERE ParentID = 0