Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Recursive Store procedure

Author  Topic 

halexic
Starting Member

8 Posts

Posted - 2007-01-13 : 15:28:19
I need to write recursive store procedure that will return all subcategories (and their subcategories...) for given category.
I am trying to do this but I didn't succeed.

Can you help me with some example?

Table is: (Id, CategoryName, ParentId)
I am sending as parameter to store procedure ParentId.

Thanks in advance

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-01-14 : 02:12:17
see here http://www.nigelrivett.net/SQLTsql/RetrieveTreeHierarchy.html


KH

Go to Top of Page
   

- Advertisement -