• Hi Atif, in many ways I'm still a relative newbie to SQL Server... your example of a recursive CTE is probably an old technique to some of the regulars, but I'm sure glad I've found out about it!

    However, I was wondering if this is guaranteed to maintain the tree order as provided by Bhaki

    i.e.

    A

    |

    |=B

    | |=E

    | \=F

    |

    |=C

    \=D

    .

    Random Technical Stuff[/url]