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 2000 Forums
 SQL Server Development (2000)
 Need Help

Author  Topic 

deepak_sivaraman
Starting Member

1 Post

Posted - 2004-02-17 : 23:29:44
Hi,

I have a table which has two columns Brandid and Parentid.

If a particular brand has a Parent Brand then the ParentId is persent else it is null.

Now i have a BrandId and need to find all its child brands and then the child brands of the first level brands.

Something like this

1
--2
---3
----4

Right now we r using cursors to do this but it is kind of slow so is there any other way to optimize it.

Regards
Deepak

nr
SQLTeam MVY

12543 Posts

Posted - 2004-02-18 : 06:11:14
See
http://www.nigelrivett.net/RetrieveTreeHierarchy.html

Also a search on this sight for trees or hierarchies should turn up lots of suggestions.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -