SQL Server employee manager hierarchy remove circular reference
Posted by:
adcertpoint
(Moderator)
Date: July 22, 2021 07:14PM
I have an employee list; each employee is assigned to a manager. The manager will change at any time for the employees. I am using a recursive CTE to get the manager's employee.
I am getting this error
The maximum recursion 100 has been exhausted before statement completion
when hierarchy is like this:
x => y
y => z
z => x
x => y
I want to skip the circular reference for employee x => y when getting manager hierarchy employees.