SQL Hierarchies – Parent & Child Relationships

It’s an oldie but a goody, but if you’ve ever had the need to doany sort of performant querying on branches of a tree, take a lookat my article on SQLHierarchies. I’ve gotten a lot of great feedback regarding it,and it still seems to be serving a lot of people’s needs.

Of course SQL Server 2005 brings Common Table Expressions, whichoffers a syntactically easier method of querying hierarchies, butit still relies upon recursive looping to build its set, whereasthe technique I detail can build a response set using avery high performance index backed operation.