Click here to Skip to main content
15,886,137 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am writing a stored procedure that would generate parent-child relation of a category list(multi-level). There I am trying to generate new variables in a stored procedure. Please help me out with the code.

Category list:
cat1
cat1>>sub1
cat1>>sub2
cat1>>sub2>>sub22...

and so on.
Posted
Updated 29-Dec-11 20:32pm
v2

1 solution

you don't need to create dynamic variables. you can use can use recursive logic to get all child nodes.
pl check the following

SQL code to traverse self-referencing tables with parent-child relationships[^]

using CTE

http://stackoverflow.com/questions/207309/sql-query-for-parent-child-relationship[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900