You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following is a recursive CTE that recursively retrieves the parent (3 layers) of [businessunit]:
WITH cte
AS (SELECTNULLAS [child],
e0.logicalnameAS [parent],
e0.logicalnameAS [path],
0AS [depth]
FROMmetadata.entityAS e0
WHEREe0.logicalnameIN ('businessunit')
UNION ALLSELECTrs.referencingentityAS [child], --(※1)--cte.parent AS [child], (※2)rs.referencedentityAS [parent],
cte.path+'/'+rs.referencedentityAS [path],
cte.depth+1AS [depth]
FROM cte AS cte
INNER JOINmetadata.relationship_n_1AS rs
ONcte.parent=rs.referencingentityWHEREcte.depth<3)
SELECT*FROM cte
ORDER BY depth;
All [child] columns have the same value. This is clearly wrong.
actual
expected
When I used (*2) instead of (*1), the result changed. This is also strange.
The text was updated successfully, but these errors were encountered:
The following is a recursive CTE that recursively retrieves the parent (3 layers) of [businessunit]:
The text was updated successfully, but these errors were encountered: