Procedure Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32)?

Each call to EXEC GetMSOrg keeps progressing along the query SELECT @ReportsToPersonnelNbr = ReportsToPersonnelNbr FROM ReportsTo WHERE PersonnelNumber = @PersonnelNumber And there is an exit clause when PersonnelNumber no longer reports to anyone Therefore the only logical conclusion is that you have a cyclical person->reportsto->..->person. This could even be on a single record This query will find loops within the reportsto records: declare @PersonnelNumber int set @PersonnelNumber = 10 ;with CTE as ( select 1 Level, convert(varchar(max),@PersonnelNumber) Seed, '>>' + convert(varchar(max),@PersonnelNumber) + '>>' Path union all SELECT Level+1, convert(varchar(max),ReportsToPersonnelNbr), Path + convert(varchar(max),ReportsToPersonnelNbr) + '>>' FROM ReportsTo join CTE on CTE. Seed = ReportsTo.

PersonnelNumber where Level ' + convert(varchar(max),Seed) + '>', '')) = LEN(Path) - Len('>' + convert(varchar(max),Seed) + '>') * 2.

Each call to EXEC GetMSOrg keeps progressing along the query SELECT @ReportsToPersonnelNbr = ReportsToPersonnelNbr FROM ReportsTo WHERE PersonnelNumber = @PersonnelNumber And there is an exit clause when PersonnelNumber no longer reports to anyone. Therefore the only logical conclusion is that you have a cyclical person->reportsto->..->person. This could even be on a single record.

This query will find loops within the reportsto records: declare @PersonnelNumber int set @PersonnelNumber = 10 ;with CTE as ( select 1 Level, convert(varchar(max),@PersonnelNumber) Seed, '>>' + convert(varchar(max),@PersonnelNumber) + '>>' Path union all SELECT Level+1, convert(varchar(max),ReportsToPersonnelNbr), Path + convert(varchar(max),ReportsToPersonnelNbr) + '>>' FROM ReportsTo join CTE on CTE. Seed = ReportsTo. PersonnelNumber where Level ' + convert(varchar(max),Seed) + '>', '')) = LEN(Path) - Len('>' + convert(varchar(max),Seed) + '>') * 2.

Thanks everyone! – Nick Feb 22 at 22:58 Richard what can be done to resolve this? – Nick Feb 22 at 22:59 @Nick - please see addition to answer – Richard aka cyberkiwi Feb 22 at 23:21.

CREATE PROCEDURE dbo. SELECT @OrgTerm = s. JOIN Taxonomy..StaticHierarchy s ON tm.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions