Hi I'm building an MVC 4 report, and using EF5. Database is on SQL 2005.
The report has a large amount of long string filters, when there are a lot of them selected, I got this error:"Some part of your SQL statement is nested too deeply. Rewrite the query or break it up into smaller queries."
Filters are selected and return a List, and in the LINQ query I use:
DataContext.Entity.Where(list.Contains(column));
return IQueryable<Entity>;
I guess it's the LINQ-generated SQL query that gets over the limit, and I don't know what is the limit.
Is there any way we could control this limit? or please point out if my guess was wrong.
Thanks a lot.
Thanks for the link below, provided by @AdrianFaciu , and it's really helpful, I think it's similar issue. (I guess my each string filter's length is too long, and there are a lot of them.) Hitting the 2100 parameter limit (SQL Server) when using Contains()
I have read a few workarounds, but still looking for a proper solution, not by generating string queries. It seems at least for now, I have to load data step by step to reduce the length of the query.