# Updating data in SQL with Power Table

**URL:** <https://forum.inductiveautomation.com/t/updating-data-in-sql-with-power-table/28504>\
**Category:** Ignition\
**Created:** [September 24, 2019, 1:25pm UTC](https://forum.inductiveautomation.com/t/updating-data-in-sql-with-power-table/28504 "2019-09-24T13:25:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nlanc97](https://avatars.discourse-cdn.com/v4/letter/n/c0e974/32.png) [@nlanc97](https://forum.inductiveautomation.com/u/nlanc97)\
**Post date:** [September 24, 2019, 1:25pm UTC](https://forum.inductiveautomation.com/t/updating-data-in-sql-with-power-table/28504/1 "2019-09-24T13:25:03Z")

</div>

I am trying to use a Power Table to edit data in SQL. Where did I go wrong?

```auto
Index = self.data.getValueAt(rowIndex,0)
query = "UPDATE Production_Schedule_Table SET %s = ? WHERE Index = ?" % colName
system.db.runPrepUpdate(query,[newValue, Index],'13290_Statistics')
system.db.refresh(self.data)

```

---

<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:** [September 24, 2019, 1:29pm UTC](https://forum.inductiveautomation.com/t/updating-data-in-sql-with-power-table/28504/2 "2019-09-24T13:29:08Z")

</div>

You really shouldn't double-post. That just breaks up context and makes it hard to understand the question, like the fact that this is supposed to be an OnCellEdited event method.

> [@Power Table OnCellEdited](http://forum.inductiveautomation.com/t/power-table-oncelledited/10737/9):
>
> Any tips on what I have done wrong? Index = self.data.getValueAt(rowIndex,0) query = "UPDATE Production\_Schedule\_Table SET %s = ? WHERE Index = ?" % colName system.db.runPrepUpdate(query,[newValue, Index],'13290\_Statistics') system.db.refresh(self, data)

Actual help is over on that topic.
