This is for MS SQL Server 2005
The stored procedure has been running fine for over a year (it was written by my predecessor), but suddently today I get the following error when trying to run it:
Msg 8623, Level 16, State 1, Line 1
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.
It certainly is a complex query. It's five separate main queries unioned together. Each of those queries contains 12 subqueries. (As I said, I didn't write it)
I can run each of the main queries separately, I can even run four of the five together with no issue, but running all five throws the error.
As I said, it has been running fine since I have been here. I even modified it a few months ago and it was running when I released it (duh!).
So, what do I look at that might have changed over the weekend that is now causing it to fail?