Exception: Too many parameters were provided in this RPC request. The maximum
Exception: Too many parameters were provided in this RPC request. The maximum is 2100.
[Microsoft] [SQL Native Client] [SQL Server] The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Too many parameters were provided in this RPC request. The maximum is 2100.
Error report of SQL statement
If it is a SELECT query OR conditional statement such as: SELECT * FROM tablename WHERE x1 OR x2 OR x3 OR x4 OR. If the number of OR x2101 or conditions exceeds 2100, an error will be reported, which can be changed to UNION ALL.
If it is a SELECT query IN conditional statement such as: SELECT * FROM tablename WHERE columnname IN (1, 2, 3, 4, 5,. , 2101), if the number of IN parameters exceeds 2100, the above error will be reported. You can create a temporary table, write this data to the temporary table, and then associate it.
-- Create new table Create Table temp (myvalues uniqueidentifier)-- Join new table with your table SELECT T1 * FROM tablename T1 JOIN temp T2 ON t1.myvalues = t2.myvalues
Error reporting of stored procedures and functions
For stored procedures and functions, the maximum number of parameters is 2100
See the following restrictions:
Https://docs.microsoft.com/en-us/sql/sql-server/maximum-capacity-specifications-for-sql-server