# Update More than one Value with SQLITE

**URL:** https://discourse.nodered.org/t/update-more-than-one-value-with-sqlite/4542
**Category:** General
**Created:** [3 November 2018 23:07 UTC](https://discourse.nodered.org/t/update-more-than-one-value-with-sqlite/4542 "2018-11-03T23:07:06Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ilvesheimer](https://avatars.discourse-cdn.com/v4/letter/i/dbc845/32.png) [@ilvesheimer](https://discourse.nodered.org/u/ilvesheimer)
#### Post date: [3 November 2018 23:07 UTC](https://discourse.nodered.org/t/update-more-than-one-value-with-sqlite/4542/1 "2018-11-03T23:07:07Z")

</div>

Hello,

I started to work with SQLite a few days ago and need to update some rows with values of different variables.  
So i tried to use a funktion like this (followed by the sqlite node):

> ```
> msg.payload = global.get("GlImportArrayInt");
> var Int1 = msg.payload.value[0];
> var Int2 = msg.payload.value[1];
> 
> var DataSQLite = {
> topic : 
> "UPDATE `Data` SET `Value`="+Int1+" WHERE `_rowid_`='1';"+
> "UPDATE `Data` SET `Value`="+Int2+" WHERE `_rowid_`='2';"
> };
> 
> ```

My problem is, this just updates row1, but i need more rows to be updated.  
Any Idea how to make this work, or is there a completely other solution?  
The values are also aviable as an array. I just started with all this and hope you can help me.

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [3 November 2018 23:42 UTC](https://discourse.nodered.org/t/update-more-than-one-value-with-sqlite/4542/2 "2018-11-03T23:42:24Z")

</div>

You could try using the 'BEGIN TRANSACTION' and 'COMMIT'. See: [http://www.sqlitetutorial.net/sqlite-transaction/](http://www.sqlitetutorial.net/sqlite-transaction/)

---

<div class="post-metadata">

### Author: ![ilvesheimer](https://avatars.discourse-cdn.com/v4/letter/i/dbc845/32.png) [@ilvesheimer](https://discourse.nodered.org/u/ilvesheimer)
#### Post date: [3 November 2018 23:54 UTC](https://discourse.nodered.org/t/update-more-than-one-value-with-sqlite/4542/3 "2018-11-03T23:54:48Z")

</div>

I've already tried this version, but it didn't work for me.

But i just found the problem, i used the "Via.msg.topic" option as \</\> SQL Query in the sqlite node options.  
Now i switched to Batch without response and included the 'BEGIN TRANSACTION' and 'COMMIT' again and now it works.

It would be nice if someone can explain whats the difference between those two options, but it works for me now.
