# namedQuery - return getKey on insert

**URL:** <https://forum.inductiveautomation.com/t/namedquery-return-getkey-on-insert/22567>\
**Category:** Ignition\
**Created:** [February 14, 2019, 10:09am UTC](https://forum.inductiveautomation.com/t/namedquery-return-getkey-on-insert/22567 "2019-02-14T10:09:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [February 14, 2019, 10:09am UTC](https://forum.inductiveautomation.com/t/namedquery-return-getkey-on-insert/22567/1 "2019-02-14T10:09:35Z")

</div>

@KathyApplebaum  
In **system.db.runPrepUpdate** with getKey=1, we can return the key inserted instead of the number of rows.  
Can we do this with runNamedQuery ? (Ignition 7.9.X, Ignition 8.0?)

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [February 14, 2019, 2:39pm UTC](https://forum.inductiveautomation.com/t/namedquery-return-getkey-on-insert/22567/2 "2019-02-14T14:39:27Z")

</div>

Not at this time. Probably a good thing to suggest in the ideas forum. 🙂

---

<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:** [February 14, 2019, 4:23pm UTC](https://forum.inductiveautomation.com/t/namedquery-return-getkey-on-insert/22567/3 "2019-02-14T16:23:53Z")

</div>

Actually, even better than the ideas portal, this feature is already in our backlog - though not attached to any particular version yet.

---

<div class="post-metadata">

**Author:** ![ismaelnunez.mx](https://avatars.discourse-cdn.com/v4/letter/i/c57346/32.png) [@ismaelnunez.mx](https://forum.inductiveautomation.com/u/ismaelnunez.mx)\
**Post date:** [February 12, 2023, 7:31pm UTC](https://forum.inductiveautomation.com/t/namedquery-return-getkey-on-insert/22567/4 "2023-02-12T19:31:47Z")

</div>

Hi!,

Is this feature being attached to a version in the near future?

Kind regards!

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 12, 2023, 7:35pm UTC](https://forum.inductiveautomation.com/t/namedquery-return-getkey-on-insert/22567/5 "2023-02-12T19:35:17Z")

</div>

It is [documented for the current version](https://docs.inductiveautomation.com/display/DOC81/system.db.runNamedQuery). It has been a long time, so I have no idea how long ago it was implemented.

---

<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:** [February 13, 2023, 5:01am UTC](https://forum.inductiveautomation.com/t/namedquery-return-getkey-on-insert/22567/6 "2023-02-13T05:01:32Z")

</div>

Available since 8.0.3.
