Retrieving a complex hierarchy.

Posts   
 
    
sailu_tp
User
Posts: 6
Joined: 09-Sep-2006
# Posted on: 12-Oct-2006 18:57:25   

Is there anyway to get a complex hierarychy of data in a single call using L Pro. For ex: Parent -> Child -> GrandChild -> GreatGrandChild I know there is a prefetch path but it makes 1 call for retreiving each entity right, other than that is there any other way. Sailu

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 13-Oct-2006 02:58:25   

Not built in. We use a stored procedure that uses a CTE to return all subEntities and then we manually build the tree from the returned results. This way all of the recursion is done on the db. CTEs are only available in SQL 2005 I believe. IF you are looking for another solution there is a post on here that Frans references about adjacency lists that lets you execute a simliar query based on hierarchy id.

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 13-Oct-2006 03:02:14   

Here's some explanation from Celko http://www.sqlsummit.com/AdjacencyList.htm.