Re: Best way to recursively populate a tree based on SQL Server 2000 b
- From: "Mark" <mark@xxxxxxxxxx>
- Date: Thu, 19 May 2005 06:36:28 GMT
Thanks Pete - Data's changes quite a bit so I need to stay realively live...
Mark
"The Greek" <The Greek@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0EE9C6C4-81C4-43EB-92F8-5A1A6C2978DC@xxxxxxxxxxxxxxxx
> Mark,
>
> Reflective relationships can sometimes be a pain to deal with. If your
> data is slow changing I would highly reccommend using xml. You will still
> need to create your recursive stored procedure however instead of
> outputting
> a recordset you will be using the "for xml" clause. Once you return the
> xml,
> cache it and build your tree from the xml doc from now on. If your data
> changing all the time then you'll have to stick with running your sproc.
> There is a middle ground. You can also cache your results for a certain
> period (2 hours) and only hit the db every two hours for updates. The
> possiblities are endless and you'll have to decide what is the best fit
> for
> your design.
>
>
> Pete "The Greek" Orologas
> Neudesic Consulting
>
>
>
>
> "Mark" wrote:
>
>> Hi Folks
>>
>> I have a classic child parent relationship within the same table where an
>> unlimited number of levels is possible (theoretically). I have front-end
>> code that recursively populates a tree control by getting the children of
>> each node etc. etc. This makes potentially hundreds of calls to the
>> backend.
>>
>> What I would like to do (as I think it may be more efficient) is create a
>> single recursive stored procedure that returns all records in lineage
>> (text
>> description) order, i.e. top level first, then the first child, its
>> children
>> and so forth... I could then construct the tree by walking through the
>> data
>> in a single pass - I hope :@)
>>
>> Is this possible or is there a better / more appropriate way to achieve
>> the
>> same thing?
>>
>> I am trying to avoid multiple calls to the backend and at the same time
>> migrate the front end code to the sql server...
>>
>> Thanks very much
>>
>> Mark
>>
>>
>>
.
- References:
- Prev by Date: Re: Of course you can
- Next by Date: Re: Of course you can
- Previous by thread: RE: Best way to recursively populate a tree based on SQL Server 2000 b
- Next by thread: Of course you can
- Index(es):
Relevant Pages
|