The incoming request has too many parameters. The server supports a maximum of 2100 parameters

1.遇到的问题

### Cause: com.microsoft.sqlserver.jdbc.SQLServerException: The incoming request has too many parameters. The server supports a maximum of 2100 parameters. Reduce the number of parameters and resend the request.
; uncategorized SQLException; SQL state [S0001]; error code [8003]; The incoming request has too many parameters. The server supports a maximum of 2100 parameters. Reduce the number of parameters and resend the request.; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: The incoming request has too many parameters. The server supports a maximum of 2100 parameters. Reduce the number of parameters and resend the request.

2.官方文档

 根据据中 [SQL Server 的最大容量规范] 中规定,每个用户定义函数的参数个数最大为2100。(SQL Server 的最大容量规范 - SQL Server | Microsoft Learn )

The incoming request has too many parameters. The server supports a maximum of 2100 parameters_第1张图片

3.解决办法 

我是用mybatisplus批量插入,可以把list分成200条提交一次

  public void batchInsertTask(OutTask task, List outList) {
        List newList = new ArrayList();
        int pointsDataLimit = 100;
        int maxSize=outList.size() - 1;
        for (int i=0; i

4.总结

批量插入还可以引入多线程操作。 

提示语:大成者大累,大智者大忧,无能者无欲无求。

你可能感兴趣的:(数据结构,sqlserver)