How many params can I pass to SQL Servers IN() function?
SELECT * FROM TABLE where ID IN ( 1,2,3,4,5,..,.,....)
According to documentation - "many thousands".
This limit is 65,535.
Refer the Causes section HERE.
Including an extremely large number of values (many thousands) in an
IN clause can consume resources and return errors 8623 or 8632. To work around this problem, store the items in the IN list in a table.
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.
Internal error: An expression services limit has been reached. Please look for potentially complex expressions in your query, and try to simplify them.