Query:
update mytable
set mycol = null
where id in (
583048,
583049,
... (50000 more)
)
Message:
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.
My query is very simple,
how should I write it so it works ok?
Insert the list of values into a
#temptable then useinon that.As explained in this answer a large number of
INvalues can cause it to run out of stack as they get expanded toORSee also related connect item