# RunPrepUpdate errors during insert

**URL:** <https://forum.inductiveautomation.com/t/runprepupdate-errors-during-insert/91812>\
**Category:** Ignition\
**Tags:** database\
**Created:** [June 13, 2024, 11:09am UTC](https://forum.inductiveautomation.com/t/runprepupdate-errors-during-insert/91812 "2024-06-13T11:09:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Klara\_Motlova](https://avatars.discourse-cdn.com/v4/letter/k/49beb7/32.png) [@Klara\_Motlova](https://forum.inductiveautomation.com/u/Klara_Motlova)\
**Post date:** [June 13, 2024, 11:09am UTC](https://forum.inductiveautomation.com/t/runprepupdate-errors-during-insert/91812/1 "2024-06-13T11:09:07Z")

</div>

When executing system.db.runPrepUpdate in Designer Tools, the following errors appear and the traceback says:

"Caused by: java.lang.Exception: Error executing system.db.runPrepUpdate(  
INSERT INTO [abc] (a\_id, [Length], Width, Height)  
VALUES  
(?, ?, ?, ?)  
, [27, 45, 40,], , , true, false)

```
... 29 more

```

Caused by: com.inductiveautomation.ignition.client.gateway\_interface.GatewayException: SQL error for "  
INSERT INTO [abc] (a\_id, [Length], Width, Height)  
VALUES  
(?, ?, ?, ?)  
": Porušení omezení PRIMARY KEY pk\_abc. Nelze vložit duplicitní klíč do objektu exp.abc. Hodnota duplicitního klíče je(44). Corrected translation: PRIMARY KEY pk\_abc constraint violation. Cannot insert duplicate key into exp.abc object. The duplicate key value is (44).  
"

- Insert on its own in Azure Data Studio works well.
  - Ids must have been reset, some of them deleted, and go again from 1, skipping the already filled-in rows.

- The arguments were printed to check if there are really 4 arguments coming into the function.

I am comparing JSON data to the TSQL database data + inserting the missing data.  
Some ideas why there are these errors?

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [June 13, 2024, 11:36am UTC](https://forum.inductiveautomation.com/t/runprepupdate-errors-during-insert/91812/2 "2024-06-13T11:36:53Z")

</div>

Disregard. Replying from my phone, I ran it through a translator, and it didn't say what I imagined it did.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [June 13, 2024, 12:09pm UTC](https://forum.inductiveautomation.com/t/runprepupdate-errors-during-insert/91812/3 "2024-06-13T12:09:46Z")

</div>

> [@Klara\_Motlova](#):
>
> Some ideas why there are these errors

I think it's pretty clear that the error is caused by attempting to insert a row is a duplicate key value.

The question is how are you getting that value?

How is the primary key column configured on the table?
