thava (5/4/2014)
Yes I know it, that's why I try to cleansing it, do you have any idea how to do it using TSQL
I'm not certain that a recursive CTE is the right approach here.
Quick questions to start with:
How many edges/levels would you have from end to end?
Can a node/entry be an ancestor of itself?
Would Mainid == Referenceid denote a start/start/top level entry? (My guess is that there are many entry/start points).
😎