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
 General SQL Server Forums
 New to SQL Server Programming
 Categories. What is the best solution?

Author  Topic 

shapper
Constraint Violating Yak Guru

450 Posts

Posted - 2008-06-26 : 17:20:48
Hello,

I need to create a 4 level categories and subcategories.
I was checking the Adjacent Model but I have been told this is not the best option ... and I am having a lot of problems with it.

Could someone tell me what is the best solution to create this?
And if possible where I can find some examples?

Basically, the requirements I have are:
- Get all nodes;
- Create a node;
- Update a node;
- Delete a node and all nodes under it;

Could someone, please, help me out?

Thank You,
Miguel

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-06-26 : 19:13:19
Is this related to SQL Server?
Go to Top of Page

shapper
Constraint Violating Yak Guru

450 Posts

Posted - 2008-06-26 : 19:30:57
Sure! :-) Why would I post here?
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-06-26 : 19:34:27
Ok So its related to this one:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=105624#406237
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-27 : 00:51:09
If you're using SQL 2005, look for recursive CTE approach:-

http://msdn.microsoft.com/en-us/library/ms186243.aspx

and if you're using SQL 200, use expanding hierarchies approach:-

http://support.microsoft.com/kb/248915
Go to Top of Page
   

- Advertisement -