Last post Sep 26, 2016 01:32 PM by bchernick
Sep 21, 2016 06:16 PM|bchernick|LINK
I've been assigned to maintain an MVC/EF program that is giving me that "Some part of your SQL statement is nested too deeply. Rewrite the query or break it up into smaller queries" error.
Admittedly I have not done much with EF other than a few tutorials.
The problem is this: What query?
As far as I know (no documentation) this is one of those EF programs that uses 'Fluent API', all the table relationships defined by those 'virtual' statements.
Also when I get to the start of the datacontext call, All I can see is a sql query from the top table, not any of the other tables it's related to.
In short I have no idea where to begin troubleshooting this.
Sep 22, 2016 05:58 AM|Cathy Zou|LINK
This error message is generated by SQL Server. It indicates that a SQL query can't be analyzed because it is too complex. The new version of Entity Framework you used may have a different optimizer that will generate a more nested SQL query than before, this
is why you have this error message now.
The following link may help you understand why the error message arise in your program:
So, I suggest you need to find and simplify your query statement based on your program’s needs.
Hope this can help you. If you have any question and confusion about the problem. Please don't hesitate to let me know.
Sep 22, 2016 11:49 AM|bchernick|LINK
That's just it. I'm not sure what the 'query' is. When I look at what appears to be the query in the datacontext.tablename structure it only returns the query for a single table yet I know that table has multiple relationships and that the query can return
data from other tables (up to a point anyway). There are no joins visible.
Sep 26, 2016 01:32 PM|bchernick|LINK
Actually let's end this thread.
We've decided that the current approach is unworkable due to the size and complexity of the data and we're going in a different direction.
But thanks for your support.