I can´t find whats wrong with this recursive query:
WITH temp (Id, ParentId, iteration)
AS
(
SELECT Id, ParentId, 0 AS iteration
FROM OrgTable WHERE ParentId IS Null
UNION ALL
SELECT a.Id, b.ParentId, a.iteration + 1
FROM temp a
JOIN OrgTable b
on b.Id = a.ParentId
)
SELECT *
FROM temp
This just gives me the two records which are root objects. It doesnt give me any child rows at all.