# SQL Insert error

**URL:** <https://forum.inductiveautomation.com/t/sql-insert-error/15810>\
**Category:** Ignition\
**Created:** [October 30, 2017, 1:56pm UTC](https://forum.inductiveautomation.com/t/sql-insert-error/15810 "2017-10-30T13:56:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mr.K001](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@Mr.K001](https://forum.inductiveautomation.com/u/Mr.K001)\
**Post date:** [October 30, 2017, 1:56pm UTC](https://forum.inductiveautomation.com/t/sql-insert-error/15810/1 "2017-10-30T13:56:53Z")

</div>

Hi,  
I’m trying to run a  
system.db.runPrepUpdate(“INSERT INTO table (col1,col2,col3) values (?,?,?)” [x,y,z])  
col1 and col3 are strings and col2 is date  
I get the error “str indices must be integers”  
I’ve used this method before and i never had this issue. any idea why?  
I did some research online but couldn’t find an answer to my issue…  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![JGJohnson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jgjohnson/32/29582_2.png) [@JGJohnson](https://forum.inductiveautomation.com/u/JGJohnson)\
**Post date:** [October 30, 2017, 2:09pm UTC](https://forum.inductiveautomation.com/t/sql-insert-error/15810/2 "2017-10-30T14:09:44Z")

</div>

It looks like you are missing a comma between the SQL statement and arguments.

Try:

```auto
system.db.runPrepUpdate("INSERT INTO table (col1,col2,col3) values (?,?,?)", [x,y,z])

```

---

<div class="post-metadata">

**Author:** ![Mr.K001](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@Mr.K001](https://forum.inductiveautomation.com/u/Mr.K001)\
**Post date:** [October 30, 2017, 2:35pm UTC](https://forum.inductiveautomation.com/t/sql-insert-error/15810/3 "2017-10-30T14:35:20Z")

</div>

Oh wait, sure does like like my Idiot meter was running high… wow… how I missed that I have no idea lol. Thanks for the help!!👍
