I to incoming outside one parameter, whether it exists in recursion detected data
WITH TEMP AS
(
SELECT * FROM Document_FileType WHERE Id=18
UNION ALL
SELECT A. * FROM Document_FileType JOIN A TEMP ON Amy polumbo arentId=TEMP. Id
)
SELECT * FROM TEMP WHERE Id & lt;> 18