码迷,mamicode.com
首页 > 数据库 > 详细

mybatis+sqlserver批量操作数据库报错:The server supports a maximum of 2100 parameters

时间:2020-10-18 10:14:48      阅读:56      评论:0      收藏:0      [点我收藏+]

标签:HERE   ota   support   出错   param   app   _id   material   net   

sqlserver中,insert和update,会判定长度是否超过2100,超过就会报错,我这边更新超过100就报错了(需要研究一下为什么100条数据就报错了)。

批量操作中出错,看我是怎么解决的,如下:

 


 

1.xxxServiceImpl.java:

技术图片

 

 

 

 

 2.xxxMapper.java

技术图片

 

3. xxxMapper.xml

    
    <update id="updatePoInfo"
        parameterType="java.util.List">
             <foreach collection="updatePoList" item="p" index="index" open="" close="" separator=";">
        update production_order
        <set>
        plant = #{p.plant},
        order_type = #{p.orderType},
        batch_no =#{p.batchNo},
        customer_code = #{p.customerCode},
        customer_name
        =#{p.customerName},
        material_no = #{p.materialNo},
        mode_no =#{p.moldNo},
        cust_material_no =
        #{p.custMaterialNo},
        order_qty =#{p.orderQty},
        uom =
        #{p.uom},
        packing_category =#{p.packingCategory},
        country = #{p.country},
        mpt
        =#{p.mpt},
        mpq = #{p.mpq},
        mpt_material_no =#{p.mptMaterialNo},
        length =
        #{p.length},
        width =#{p.width},
        high = #{p.high},
        apt =#{p.apt},
        apq = #{p.apq},
        assortment_id
        =#{p.assortmentID},
        assortment_description =
        #{p.assortmentDescription},
        total_carton_qty =#{p.totalCartonQty},
        rel_date
        =#{p.relDate},
        locco =
        #{p.locco},
        airplane_type =#{p.airplaneType},
        zscxs =
        #{p.zscxs}
</set>
        where
        production_order = #{p.productionOrderNo}
      </foreach>
    </update>

 

 

4.运行后报错:

技术图片

 

mybatis+sqlserver批量操作数据库报错:The server supports a maximum of 2100 parameters

标签:HERE   ota   support   出错   param   app   _id   material   net   

原文地址:https://www.cnblogs.com/PinkPink/p/13832766.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!