patternsqlMinor
What is the maximum number of parameters I can pass using the SQL IN clause in SQL server 2008 and SQL server 2000?
Viewed 0 times
cannumberthemaximumwhatpasssql20082000and
Problem
My program lets people pick items from a list to help run a query. To return the minimum amount of data, I've had to use the IN clause.
I'm pretty sure there's a limit to how many items I can put in the IN clause of one SELECT statement, but I don't know exactly what the limit is. For my case, I need to know the limit for SQL server 2000 and SQL server 2008.
Thanks!
I'm pretty sure there's a limit to how many items I can put in the IN clause of one SELECT statement, but I don't know exactly what the limit is. For my case, I need to know the limit for SQL server 2000 and SQL server 2008.
Thanks!
Solution
There isn't a quantity limit on the number of items in the IN clause. The only limit is that the entire batch cannot be more than the batch size maximum. In SQL 2008, this is 65,536 * Network Packet Size. In SQL 2000, I'm not sure if the limit was smaller than that.
This link describes these limits for 2008
This link describes these limits for 2008
Context
StackExchange Database Administrators Q#14161, answer score: 8
Revisions (0)
No revisions yet.