# SQL runPrepUpdate argument max limit

**URL:** <https://forum.inductiveautomation.com/t/sql-runprepupdate-argument-max-limit/17239>\
**Category:** Ignition\
**Created:** [March 5, 2018, 10:53pm UTC](https://forum.inductiveautomation.com/t/sql-runprepupdate-argument-max-limit/17239 "2018-03-05T22:53:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![richardNZ15](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/richardnz15/32/33373_2.png) [@richardNZ15](https://forum.inductiveautomation.com/u/richardNZ15)\
**Post date:** [March 5, 2018, 10:53pm UTC](https://forum.inductiveautomation.com/t/sql-runprepupdate-argument-max-limit/17239/1 "2018-03-05T22:53:17Z")

</div>

Hi,

I have been successfully using the system.db.runPrepUpdate function all over the place for UPDATE and INSERT queries.  
I have been getting errors when trying to a very large INSERT using this function though, a sample size of 143, which means it has 143 x 3 args to pass through.  
Here is the error thrown up on the gateway logs:

`([default]Gisborne01/ProdSystems/QATests/QAT_ProofTest/TestNow, valueChanged) Error executing tag event script: Traceback (most recent call last): File "<tagevent:valueChanged>", line 105, in valueChanged at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.error(AbstractDBUtilities.java:357) at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.runPrepUpdate(AbstractDBUtilities.java:255) at sun.reflect.GeneratedMethodAccessor42.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) java.lang.Exception: java.lang.Exception: Error executing system.db.runPrepUpdate(INSERT INTO QAProofTestData (Test_ID,SerialNum,Stiffness) VALUES (?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?), [1883, 1000001853, 13.599055290222168, 1883, 1000001854, 14.676336288452148, 1883, 1000001855, 14.189558029174805, 1883, 1000001856, 13.22437572479248, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0, 1883, 0, 0.0], ProdTracking, , false, false)`

I have tested the exact same script but using a sample size of 4, which works fine.  
I’m wondering if there is an upper limit to how many arguments can be passed into a prepared statement like this.

Thanks

---

<div class="post-metadata">

**Author:** ![richardNZ15](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/richardnz15/32/33373_2.png) [@richardNZ15](https://forum.inductiveautomation.com/u/richardNZ15)\
**Post date:** [March 5, 2018, 11:00pm UTC](https://forum.inductiveautomation.com/t/sql-runprepupdate-argument-max-limit/17239/2 "2018-03-05T23:00:05Z")

</div>

I believe this might be failing a Foreign Key constraint in my QAT\_ProofTestData table, where the SerialNum column cannot be 0.
