Skip to main content

Error: The maximum recursion 100 has been exhausted before statement completion.

Error: The maximum recursion 100 has been exhausted before statement completion.

H
Written by Harry Ledger
Updated over 2 months ago

This issue occurs when two employees are set to manage each other. To identify the other employee, follow these steps.

  1. Log into the SelectHR Administrator tool.

  2. Select Import/Export Data

  3. Create an export definition.

  4. Select the data to export.

  5. From the Database dropdown, select SelectHR

  6. Click OK.

  7. Select the SQL tab and copy the code seen below.

    DECLARE @Schema NVARCHAR(100) = 'Organisation'; DECLARE @Table NVARCHAR(100) = 'Post Details'; DECLARE @KeyField NVARCHAR(100) = 'Post Number'; DECLARE @ReferenceField NVARCHAR(100) = 'Manager Post Number'; EXEC (' DECLARE @Keys ZZSystem.KeyNumbers; INSERT INTO @Keys EXECUTE dbo.[Find Self-Referenced] '''+@Schema+''','''+@Table+''','''+@KeyField+''','''+@ReferenceField+''' ; SELECT * FROM ['+@Schema+'].['+@Table+'] tbl JOIN @Keys k ON tbl.['+@KeyField+'] = k.[Key Number] ')
  8. Click Data.

  9. Make a note of the Post Numbers that appear in the returned data.

  10. Now, copy the below SQL:

    Select Organisation.[Post Details].[Post Number],        Organisation.[Post Details].[Post Name],        [Post Details1].[Post Name] As [Managed By (1) ],        [Post Details2].[Post Name] As [Managed By (2) ],        [Post Details3].[Post Name] As [Managed By (3) ],        [Post Details4].[Post Name] As [Managed By (4) ],        [Post Details5].[Post Name] As [Managed By (5) ],        [Post Details6].[Post Name] As [Managed By (6) ],        [Post Details7].[Post Name] As [Managed By (7) ] From Organisation.[Post Details]     Left Join Organisation.[Post Details] [Post Details1]         On Organisation.[Post Details].[Manager Post Number] = [Post Details1].[Post Number]     Left Join Organisation.[Post Details] [Post Details2]         On [Post Details1].[Manager Post Number] = [Post Details2].[Post Number]     Left Join Organisation.[Post Details] [Post Details3]         On [Post Details2].[Manager Post Number] = [Post Details3].[Post Number]     Left Join Organisation.[Post Details] [Post Details4]         On [Post Details3].[Manager Post Number] = [Post Details4].[Post Number]     Left Join Organisation.[Post Details] [Post Details5]         On [Post Details4].[Manager Post Number] = [Post Details5].[Post Number]     Left Join Organisation.[Post Details] [Post Details6]         On [Post Details5].[Manager Post Number] = [Post Details6].[Post Number]     Left Join Organisation.[Post Details] [Post Details7]         On [Post Details6].[Manager Post Number] = [Post Details7].[Post Number]
  11. In the top left, click Options, Paste SQL from Clipboard.

  12. In the Organisation.[Post Details].[Post Number] criteria enter one of the Post Numbers you made a note of in Step 9.

  13. Click Data.

You should not see any Post Name appear more than once in the list. If you do, this is where the recursion is and you need to remove the recursion at the highest level.

Did this answer your question?