Troubleshooting
Error 8621
Severity Level 16
Message Text
Internal Query Processor Error: The query processor ran out of stack space during query optimization.
Explanation
The Query Processor is using a large but limited memory stack when optimizing queries. In some extreme situations the stack size may become a limit for a given very large query--for example, a query containing an inlist with 100,000 constants.
Action
Simplify the query to avoid this problem. For example, in the case of an extremely large inlist use temporary table or table variable to store the constants, and rewrite the query to use this variable or temporary table instead.