finding end and parent nodes in a recursive table
Posted on 2004-10-21
I'm trying to find an efficent way to find the end node id to assign products, because in the system that I am writing I can only add products at the end nodes.
I've got the catalog structure stored in a table:
[CatalogID] [int] IDENTITY (1000, 1) NOT NULL ,
[ParentID] [int] NOT NULL ,
[StatusID] [int] NOT NULL
So, I need the output to be in a recordset with two columns name and id.
parent level = [bikes,1000]
sub level [red,1002] ...
sub levels continuing [name,catalogid]
end node [Red LT Cruiser,1003]
so if the end node is 30 levels deep it would produce a recordset in that order.
any ideas on that?