Sol, Just looking at your solution It works well except that it doesnt return the Root node value, so I would suggest a Left Outer join on the Insert into @ty and it should all be good.
_________________________________________________________________________
SSC Guide to Posting and Best Practices