Groups | Blog | Home
all groups > sql server programming > april 2004 >

sql server programming : I need to produce a menu and its sub menus up to 3 layers deep ....


Dave Londeck
4/7/2004 10:10:36 PM
How do I pass a variable into a query and return a result set which will
give me all of the parents and its chiildren as they are tied together in
one table?
The structure could be as folllows
Table
( MenuID as int,
ParentID as int,
Description as varchar(25),
Text as varchar(25),
)
The menuid is unique for each row. Zero is reserved as root and would be a
Parentid.
I just need something that would be sufficient to fill out a tree view
listing.
I have done this before I just forgot how....
Any help would be appreciated..

Eric Sabine
4/8/2004 8:05:09 AM
There are tons of examples of how to do hierarchies in this NG. Just do a
google search on keywords like BOM, Bill of Materials, organizational
charts, recursion, family trees, nested iterations, enumerated paths, nested
sets, celko, ben-gan, common table expressions, CTE (last 2 are in Yukon,
Itzik Ben-Gan has a couple whitepapers on MSDN I believe).

hth
Eric



[quoted text, click to view]

AddThis Social Bookmark Button