# SQLite Error - Exporting data to sql database

**URL:** <https://discourse.nodered.org/t/sqlite-error-exporting-data-to-sql-database/65599>\
**Category:** General\
**Tags:** node-red-dashboard\
**Created:** [25 July 2022 19:06 UTC](https://discourse.nodered.org/t/sqlite-error-exporting-data-to-sql-database/65599 "2022-07-25T19:06:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![keshavvasudeva](https://avatars.discourse-cdn.com/v4/letter/k/ad7895/32.png) [@keshavvasudeva](https://discourse.nodered.org/u/keshavvasudeva)\
**Post date:** [25 July 2022 19:06 UTC](https://discourse.nodered.org/t/sqlite-error-exporting-data-to-sql-database/65599/1 "2022-07-25T19:06:28Z")

</div>

I have the following code in Node Red:  
msg = {  
"topic": "INSERT INTO TestTable (PV, SV) values (" + "'" + parseFloat(flow.get("PV") / 10) + "," + parseFloat(flow.get("SV")) + "')",  
}  
return msg;

However, I am getting the following error: "Error: SQLITE\_ERROR: 1 values for 2 columns". Both PV and SV are valid values which I have verified by outputting both individually. What can I do?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [25 July 2022 20:14 UTC](https://discourse.nodered.org/t/sqlite-error-exporting-data-to-sql-database/65599/2 "2022-07-25T20:14:35Z")

</div>

Feed the output of your function into a debug node set to output complete message and see what the topic is set to.

---

<div class="post-metadata">

**Author:** ![keshavvasudeva](https://avatars.discourse-cdn.com/v4/letter/k/ad7895/32.png) [@keshavvasudeva](https://discourse.nodered.org/u/keshavvasudeva)\
**Post date:** [25 July 2022 20:46 UTC](https://discourse.nodered.org/t/sqlite-error-exporting-data-to-sql-database/65599/3 "2022-07-25T20:46:52Z")

</div>

I figured that error out. I am not stuck on a new error. Here is my corrected code:  
msg = {  
"topic": "INSERT INTO TestTable (PV, SV) values (" + "'" + parseFloat(flow.get("PV") / 10) + "'" + parseFloat(flow.get("SV") / 10) +",')"  
}  
return msg;

and here is the error: "Error: SQLITE\_ERROR: near "20.3": syntax error". where 20.3 is the value of SV.

Any ideas??

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [26 July 2022 05:54 UTC](https://discourse.nodered.org/t/sqlite-error-exporting-data-to-sql-database/65599/4 "2022-07-26T05:54:47Z")

</div>

> [@keshavvasudeva](#):
>
> Any ideas??

My advise now is exactly the same as last time.

> [@Colin](#):
>
> Feed the output of your function into a debug node set to output complete message and see what the topic is set to.

---

<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:** [26 July 2022 10:35 UTC](https://discourse.nodered.org/t/sqlite-error-exporting-data-to-sql-database/65599/5 "2022-07-26T10:35:23Z")

</div>

In your definition of the table, what 'TYPE's did you define for PV and PS

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [24 September 2022 10:35 UTC](https://discourse.nodered.org/t/sqlite-error-exporting-data-to-sql-database/65599/6 "2022-09-24T10:35:55Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
