Hierarchical (Recursive) Queries in SQL Server

This code sample demonstrates recursive queries in SQL Server. The query returns paths of Kettle transformations. with Parent as ( select ID_DIRECTORY , ID_DIRECTORY_PARENT , cast(DIRECTORY_NAME as varchar(255)) as DIRECTORY_PATH from R_DIRECTORY where ID_DIRECTORY_PARENT = 0 union all select TH.ID_DIRECTORY , TH.ID_DIRECTORY_PARENT , cast(Parent.DIRECTORY_PATH + '/' + DIRECTORY_NAME as varchar(255)) as DIRECTORY_PATH from R_DIRECTORY TH […]