# Looping updates in a transaction question (execUpdate vs beginNamedQueryTransaction)

**URL:** <https://forum.inductiveautomation.com/t/looping-updates-in-a-transaction-question-execupdate-vs-beginnamedquerytransaction/112200>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [November 14, 2025, 9:47pm UTC](https://forum.inductiveautomation.com/t/looping-updates-in-a-transaction-question-execupdate-vs-beginnamedquerytransaction/112200 "2025-11-14T21:47:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![drewdin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/drewdin/32/3363_2.png) [@drewdin](https://forum.inductiveautomation.com/u/drewdin)\
**Post date:** [November 14, 2025, 9:47pm UTC](https://forum.inductiveautomation.com/t/looping-updates-in-a-transaction-question-execupdate-vs-beginnamedquerytransaction/112200/1 "2025-11-14T21:47:56Z")

</div>

I’m using ignition 8.3 and have some questions about looping a few thousand update statements.

We found that some data was entered incorrectly and its easier to update the rows programaicly rather than doing them manually.

Looking into using transactions I noticed that the runNamedQuery is deprecated for execUpdate while beginNamedQueryTransaction is still available.

I planned on creating a screen that shows the updates for validation and then using a named query for the update statement, looping the result set in a transaction with beginNamedQueryTransaction and performing the updates in one fail swoop.

Is there any reason to use execUpdate or something different? Any suggestions or alternatives? Thanks!

---

<div class="post-metadata">

**Author:** ![code\_skin](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@code\_skin](https://forum.inductiveautomation.com/u/code_skin)\
**Post date:** [November 14, 2025, 10:26pm UTC](https://forum.inductiveautomation.com/t/looping-updates-in-a-transaction-question-execupdate-vs-beginnamedquerytransaction/112200/2 "2025-11-14T22:26:30Z")

</div>

I would recommend using execUpdate since it handles scoping better. This was a pain point for projects that used NamedQuery in gateway and client scopes. ExecUpdates’ default behavior handles this gracefully. Specifically, the optional **project** argument.

Manual link: [system.db.execUpdate | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.3/appendix/scripting-functions/system-db/system-db-execUpdate)  
Excerpt:

> **Note** : If no project is specified when run in the Gateway scope, an associated project or the Gateway scripting project will be used.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [November 14, 2025, 10:38pm UTC](https://forum.inductiveautomation.com/t/looping-updates-in-a-transaction-question-execupdate-vs-beginnamedquerytransaction/112200/3 "2025-11-14T22:38:07Z")

</div>

Essentially, in 8.3 `runNamedQuery` was split into three functions - `execQuery`, `execUpdate`, and `execScalar`. They do essentially the same thing as they previously did, it's just a bit easier to reason about. You still create transactions with `beginNamedQueryTransaction` and pass transactions to the functions in the same way. As @code_skin mentioned, a key reason for the new functions was the unfixable error in the function signature(s) of `runNamedQuery` across different scopes.

---

<div class="post-metadata">

**Author:** ![drewdin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/drewdin/32/3363_2.png) [@drewdin](https://forum.inductiveautomation.com/u/drewdin)\
**Post date:** [November 16, 2025, 7:06pm UTC](https://forum.inductiveautomation.com/t/looping-updates-in-a-transaction-question-execupdate-vs-beginnamedquerytransaction/112200/4 "2025-11-16T19:06:02Z")

</div>

Thanks, mine will be called from the perspective session but will be executed from the gateway. Is one recommended over the other or does it just come down to scope? Thanks!
