Execution error in SQL Server 2012 - The query processor ran out of internal resources and could not produce a query plan

Hello all,

Will the below issue be resolved if I upgrade from Version service pack 1 to 2?

I got an error when executed my stored proc from sql server 2012 and here is the error message:

Msg 8623, Level 16, State 1, Procedure Employee_Timesheet, Line 17
The query processor ran out of internal resources and could not produce a query plan. This is a rare event and only expected for extremely complex queries or queries that reference a very large number of tables or partitions. Please simplify the query. If you believe you have received this message in error, contact Customer Support Services for more information.

Thanks all

Upgrading will not fix this issue - but you should upgrade to service pack 3 and the latest CU anyways.

The problem is your query - you need to review the query and rewrite it so it isn't too complex for the optimizer. Either you have way too many tables or you are querying from a derived table, that is using a derived table, that is using a derived table, and on and on...

It could also be caused by querying a view that is a view of a view that is a view of a view, and so on...

1 Like

You may simplify the query: https://blogs.technet.microsoft.com/mdegre/2012/03/13/8623-the-query-processor-ran-out-of-internal-resources-and-could-not-produce-a-query-plan/

Hope this will help You!!!!!!!!!!!!!!!!!!

1 Like

Why not post the SQL?

Thanks Jason. I did re write the query and it is working...I just need to make sure I don't do too much subqueries, Union, etc...

1 Like

Thanks Jotorre. I got it working.