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
 Transact-SQL (2000)
 Problem about recursion

Author  Topic 

deadfish
Starting Member

38 Posts

Posted - 2003-12-05 : 11:26:20
Hi,

Suppost I have the following table

employee supervisor
E1 E2
E2 E3
E3 E4
E4 E1
E5 E1

This tables stores the supervisor for each employee. If I would like to build a tree for this table, there will be an infinite recursion for E1. Besides putting all parent supervisor in an array and check if there is any repeated element every time, is there any faster way to check it??

Thanks in advance.

drymchaser
Aged Yak Warrior

552 Posts

Posted - 2003-12-05 : 12:22:38
Have you read this? It is excellent.

[url]http://www.sqlteam.com/item.asp?ItemID=8866[/url]
Go to Top of Page
   

- Advertisement -