# SQL help, please!

**URL:** <https://forum.inductiveautomation.com/t/sql-help-please/8737>\
**Category:** Ignition\
**Created:** [July 16, 2014, 1:44pm UTC](https://forum.inductiveautomation.com/t/sql-help-please/8737 "2014-07-16T13:44:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![treyg](https://avatars.discourse-cdn.com/v4/letter/t/439d5e/32.png) [@treyg](https://forum.inductiveautomation.com/u/treyg)\
**Post date:** [July 16, 2014, 1:44pm UTC](https://forum.inductiveautomation.com/t/sql-help-please/8737/1 "2014-07-16T13:44:04Z")

</div>

I am running the following:

TimeValue = event.source.parent.getComponent(‘CurrentTime’).text  
insertQuery = “INSERT INTO linedata (timestamp) VALUES (’%s’)”  
system.db.runUpdateQuery(insertQuery %(TimeValue),“DemoSQL”)

The code is supposed to take the current time (string), and write it into a new row in a database (linedata) in a column (timestamp).  
The code runs, but does nothing - nada.  
What could be the problem?  
Appreciate it!  
Trey

---

<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:** [July 16, 2014, 1:55pm UTC](https://forum.inductiveautomation.com/t/sql-help-please/8737/2 "2014-07-16T13:55:43Z")

</div>

Try this instesd

`TimeValue = event.source.parent.getComponent('CurrentTime').text
insertQuery = "INSERT INTO linedata (timestamp) VALUES ('%s')" % TimeValue
system.db.runUpdateQuery(insertQuery, "DemoSQL") `

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [July 16, 2014, 2:41pm UTC](https://forum.inductiveautomation.com/t/sql-help-please/8737/3 "2014-07-16T14:41:39Z")

</div>

I don’t see anything wrong with your code. How do you know nothing is happening? Are you getting any errors? Any errors in the Output Console? Are you getting any new rows in the linedata database table? Are you looking in the right database?

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [July 17, 2014, 11:00am UTC](https://forum.inductiveautomation.com/t/sql-help-please/8737/4 "2014-07-17T11:00:11Z")

</div>

You will need single quotes around ‘timestamp’. Otherwise it will treat timestamp as a python variable. 😉
