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)
 Handling heirarchies in SQL SELECTs

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-08-15 : 07:03:51
Monty writes "Do we have a heirarchical select in SQL.
For instance there are parent - child relations stored in the same table... can I issue a select to determine the depth of each row
Oracle has a CONNECT BY etc.... is there an equivalent in Transact SQL... if so can you direct me to an example pls.


Thks much.


Monty..."

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2003-08-15 : 07:52:24
No, there is nothing like CONNECT BY in SQL Server (nor in the ANSI Standard, afaik).

You'll have to type as many self-joins as the depth in your adjacency model that you'd like to traverse. It is because of this that deep hierarchies (or especially hierarchies of unknown depth) should not be modeled as adjacency, but rather as nested-sets or Rob's model or something of your own creation.

Jay White
{0}
Go to Top of Page
   

- Advertisement -