Forgetting to set the “maxrecursion” Option
Ever get this running a recursive CTE query? I have and every time I get this error I kick myself, literally kick myself for not including the “maxrecursion” option on my query. It’s quite an easy fix. Simply add the option (maxrecursion 0) at the end of your select from your CTE and no more recursion issues. This option allows you to specify how often the CTE can recurse before generating an error. The Maxrecursion 0 allows infinite recursion.