Resolving OleDB Error Server stack limit has been reached 8631

Product Feature: Data mart

Operating System: Windows 2008 R2 2012

Database: SQL Server 2008 R2 2012



When running a deeply nested query on SQL Server 2008 R2 or 2012 the following error is seen:

 OleDb Error:Server stack limit has been reached.  Please look for potentially deep nesting in your query and try to simplify it.  ErrorInfo: 8631.



Bug in SQL Server 2012 and 2008 R2



UPDATED: August 24, 2017
 This Error has been addressed for SQL Server 2012 at:

NOTE: This error is not documented as having been fixed in any available patches or service packs available for SQL Server 2008 R2.  Therefore it is possible that the problem may have been corrected in one of these releases, but not publicly documented.