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)
 Storing / Querying Hierarchical Data

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-02-11 : 08:49:43
Matthew writes "This is really two questions. I need to know if there is an efficient way to store and query hierarchical data, where the table consists of parent and child pairs of data. The parent in one row may be the child in the next. Storing the data seems straighforward, but querying it doesn't.

Question 1
Is there an easy way to query for the child and the highest level parent?

Question 2
Is there a way to add a table constraint so that circular references cannot be added?

I'm still in the process of data modeling for this project, so any guidance would be a big help."

JustinBigelow
SQL Gigolo

1157 Posts

Posted - 2002-02-11 : 09:58:58
Before you commit to an adjacency list model consider nested sets. Check out the this article for more info...
[url]http://www.intelligententerprise.com/001020/celko1_1.shtml[/url]

hth,
Justin

Go to Top of Page
   

- Advertisement -