-
I receive a message from MS SQL: "The server supports a maximum of 2100 parameters ". I have a list with many items (about 2480 items), and I use "contain" method like this: "m=> listStudentIds.Contain(m.StudentId)". @phnx47 How can I resolve this problem? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 15 replies
-
SQL limitation which does not allow more than 2100 parameters in a SQL statement. You can split your query, use just 2100 parameters in 1 query, similar code used for BulkInsert: |
Beta Was this translation helpful? Give feedback.
-
@phnx47 . I see that each item in list was converted to clause of sql query. |
Beta Was this translation helpful? Give feedback.
-
@phnx47 . This problem cause by Dapper. I fixed by re-generate Sql query if have IN clause with too many (1500) params. I created some types TVP and call Dapper QueryAsync method with tvp param instead of array. I think this only fix for MSSQL, and there is problem about performance when using TVP. |
Beta Was this translation helpful? Give feedback.
SQL limitation which does not allow more than 2100 parameters in a SQL statement.
You can split your query, use just 2100 parameters in 1 query, similar code used for BulkInsert:
dapper-repositories/src/DapperRepository.BulkInsert.cs
Line 49 in 3258450