• Dear Experts

    @luis Cazares\@Sean Lange: Thanks for your effort and indeed this is great piece of work ,Knowledge Sharing and outstanding support.

    @luis Cazares: This is an excellent script ..

    As I can see first getting the relationship

    SELECT CAST( CAST( ParentID AS varchar(10))+ '/' + CAST( ChildID AS varchar(10)) AS varchar(8000)) AS String,

    ParentID,

    ChildID

    FROM Hierarchy

    WHERE ParentID = @Value

    Secondly It look for cross join with CTE child and main table sub class parent ...Based on this it keeps getting Main table child and the required output we are getting that is fantastic.

    I have been told to extend this query based on the below information.

    Could you please teach me Sir.

    No parameters passing: when we select * from rcte

    Please refer the attached file as if it's not clear.

    The output should display as follow

    P Child Output

    101 1 101/1/6

    1 6 1/6

    101 2 101/2/4

    2 4 2/4

    2 5 2/5/6

    5 6 5/6

    5 7 5/7

    101 3 101/3/5

    3 5 3/5