# Use system.db.runUpdateQuery with variable value counts

**URL:** <https://forum.inductiveautomation.com/t/use-system-db-runupdatequery-with-variable-value-counts/42658>\
**Category:** Ignition\
**Created:** [January 27, 2021, 3:39pm UTC](https://forum.inductiveautomation.com/t/use-system-db-runupdatequery-with-variable-value-counts/42658 "2021-01-27T15:39:27Z")\
**Posts on this page:** 1\
**Showing post:** 3

<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:** [January 27, 2021, 5:17pm UTC](https://forum.inductiveautomation.com/t/use-system-db-runupdatequery-with-variable-value-counts/42658/3 "2021-01-27T17:17:19Z")

</div>

Instead of inserting a ‘%s’ for each value that you want, build a single string representing the value list that you need. Similar to how you converted the Tuple to a string.

```auto
def transactionInsert(Labels, Values):
    system.db.runUpdateQuery('INSERT INTO DataTable (%s) VALUES (%s) ' % (','.join(Labels),','.join(Values))

```

There is no need to import system, that is done automatically for you.

Be careful here, as this approach can be open to SQL Injection.

---

_[View the full topic](https://forum.inductiveautomation.com/t/use-system-db-runupdatequery-with-variable-value-counts/42658)._
