>I got this:
>
>"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."
>
>This came after having created a very long command which includes the IN clauses with thousands of primary keys.
>
>I just had 38026 primary keys in that one. :)
I think the limit is about 1000. I've seen the same message discussed in Transact SQL forum in MSDN.
But if you need to pass that many keys for one column, why not pass them as a table instead?
If it's not broken, fix it until it is.
My Blog