Internal Query Processor Error: The Query Processor Ran Out Of Stack Space During Query Optimization

Posted January 30, 2007 at 12:34 PM

Tags: SQL

Wooohooo! I got a SQL server error that I have never seen before:

Internal Query Processor Error: The Query Processor Ran Out Of Stack Space During Query Optimization.

I am working on an old report for a client that originally had a small set of data and now has an ENOURMOUS set of data. Looks like it's time to start breaking a query up into smaller queries - give the SQL server less to worry about.

Comments (4)  |  Post Comment  |  Ask Ben  |  Permalink  |  Other Searches  |  Print Page



Adobe ColdFusion 8.0.1 Update - Helping Programmers To Be Signifanctly Less Girlie - Download ColdFusion 8 Update 8.0.1 Now.

Reader Comments

Hi Ben,

Please keep us informed on your method of achieving this.

Thanks.

Posted by William from Lagos on Jan 30, 2007 at 12:59 PM


Is it a coincidence that the filename of this page starts with "500"? I find that I sometimes get this error when combining more than 500 fields in one expression in a SQL Server query.

Posted by Michel de Ruiter on Feb 27, 2007 at 6:04 AM


Microsoft offers the following solution for this problem: http://support.microsoft.com/kb/288095 however I would guess that there must be a better (and faster) way to get around this.

Posted by David Levin on Oct 21, 2007 at 4:47 AM


We received this error due to a bug that kept on appending items to a list that we used in an IN clause of a SQL Statement.
It blew up since the IN statement had 35,000 arguments.

Creating a temp table per the MS article is probably the best solution since you can throw a clustered index on the column.

This part of the MS article scared me a bit:
In some cases, SQL Server may actually shutdown as a result of the stack overflow.

Posted by Erik on Jun 20, 2008 at 12:03 PM


Post Comment  |  Ask Ben


Home   |   Web Log   |   ColdFusion   |   Projects   |   Resume   |   Job Form   |   Search   |   Contact
Epicenter Consulting - Custom Software Solutions for Business Evolution HostMySite.com - The Leader In ColdFusion Hosting