This is a simple stored procedure that returns a list of all the product categories and subcategories in the database. It is the engine behind the _Menu.aspx that builds the navigation tree control on the left hand side of the Adventure Works Cycles application.
Definition:CREATE Procedure usp_ProductCategoryList AS SELECT ProductCategoryID, [Name] FROM Production.ProductCategory ORDER BY [Name] ASC; SELECT ProductCategoryID, ProductSubcategoryID, [Name] FROM Production.ProductSubcategory ORDER BY ProductCategoryID, [Name] ASC;Database Tables Used:
ProductCategory and ProductSubCategory: The ProductCategory and ProductSubCategory tables contain a list of all the groups and subgroups of products stored in the database. The content of these tables drives the tree control on the left hand side of the web site. There is a one to many relationship between the ProductSubCategory table and the Product Table, since every product must belong to a subcategory.