# "Error: SQLITE\_ERROR: no such table: NCS"

**URL:** <https://discourse.nodered.org/t/error-sqlite-error-no-such-table-ncs/32037>\
**Category:** General\
**Created:** [26 August 2020 11:03 UTC](https://discourse.nodered.org/t/error-sqlite-error-no-such-table-ncs/32037 "2020-08-26T11:03:51Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![shipra](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shipra](https://discourse.nodered.org/u/shipra)\
**Post date:** [26 August 2020 11:03 UTC](https://discourse.nodered.org/t/error-sqlite-error-no-such-table-ncs/32037/1 "2020-08-26T11:03:51Z")

</div>

Hi, My sqlite put this error ""Error: SQLITE\_ERROR: no such table: NCS".  
Why?  
/////DATABASE???////  
sqlite\> .tables  
NCS NCS\_DATABASE

---

<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 August 2020 11:17 UTC](https://discourse.nodered.org/t/error-sqlite-error-no-such-table-ncs/32037/2 "2020-08-26T11:17:12Z")

</div>

Where do you see this error?  
what node are you using?  
did you put the full path to the database in the configuration of the node?

---

<div class="post-metadata">

**Author:** ![shipra](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shipra](https://discourse.nodered.org/u/shipra)\
**Post date:** [26 August 2020 11:21 UTC](https://discourse.nodered.org/t/error-sqlite-error-no-such-table-ncs/32037/3 "2020-08-26T11:21:14Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/b/1b8364e75aae7dfd8234a91ecfe5b8812d67e69d.png)

i am using sqlite node

How to put full path to database in configuration of node Sir .Please tell

---

<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 August 2020 11:24 UTC](https://discourse.nodered.org/t/error-sqlite-error-no-such-table-ncs/32037/4 "2020-08-26T11:24:40Z")

</div>

What have you got configured fir the database property in the node? show a screen shot

---

<div class="post-metadata">

**Author:** ![shipra](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shipra](https://discourse.nodered.org/u/shipra)\
**Post date:** [26 August 2020 11:33 UTC](https://discourse.nodered.org/t/error-sqlite-error-no-such-table-ncs/32037/5 "2020-08-26T11:33:15Z")

</div>

![2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/1/4175a454361dd22de5d12ee45cdae969f7ffbd61.png)

---

<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 August 2020 11:36 UTC](https://discourse.nodered.org/t/error-sqlite-error-no-such-table-ncs/32037/6 "2020-08-26T11:36:27Z")

</div>

and what tables have you defined in that database?

---

<div class="post-metadata">

**Author:** ![shipra](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shipra](https://discourse.nodered.org/u/shipra)\
**Post date:** [26 August 2020 11:37 UTC](https://discourse.nodered.org/t/error-sqlite-error-no-such-table-ncs/32037/7 "2020-08-26T11:37:32Z")

</div>

sqlite\> SELECT \* FROM NCS;  
1| | | |04222436| |04222536| | |  
1| | | |04222437| |04222537| | |  
sqlite\> .tables  
NCS NCS\_DATABASE  
sqlite\>

---

<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 August 2020 11:42 UTC](https://discourse.nodered.org/t/error-sqlite-error-no-such-table-ncs/32037/8 "2020-08-26T11:42:39Z")

</div>

So what is the sqlite statement you used in your flow that generated the error?

---

<div class="post-metadata">

**Author:** ![shipra](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shipra](https://discourse.nodered.org/u/shipra)\
**Post date:** [26 August 2020 11:49 UTC](https://discourse.nodered.org/t/error-sqlite-error-no-such-table-ncs/32037/9 "2020-08-26T11:49:33Z")

</div>

I havent used any flow Sir

---

<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 August 2020 11:52 UTC](https://discourse.nodered.org/t/error-sqlite-error-no-such-table-ncs/32037/10 "2020-08-26T11:52:08Z")

</div>

Well why are you asking about this on the Node-RED forum?

---

<div class="post-metadata">

**Author:** ![shipra](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shipra](https://discourse.nodered.org/u/shipra)\
**Post date:** [26 August 2020 11:54 UTC](https://discourse.nodered.org/t/error-sqlite-error-no-such-table-ncs/32037/11 "2020-08-26T11:54:31Z")

</div>

Sir actually I am using SQLITE3 in node red because I am taking a FOB ID through mqtt and going to match that with my already stored Sqlite database ,for that I am using that flow in Node Red

---

<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 August 2020 12:02 UTC](https://discourse.nodered.org/t/error-sqlite-error-no-such-table-ncs/32037/12 "2020-08-26T12:02:51Z")

</div>

You showed me the settings you user to configure the `sqlite` node so what is the sql statement you are passing to that node?

Please attach a export of your flow

---

<div class="post-metadata">

**Author:** ![shipra](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shipra](https://discourse.nodered.org/u/shipra)\
**Post date:** [26 August 2020 12:05 UTC](https://discourse.nodered.org/t/error-sqlite-error-no-such-table-ncs/32037/14 "2020-08-26T12:05:07Z")

</div>

Sure Sir.  
Here is the flow

```auto
[{"id":"a0a22bbe.4dd42","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"4ee90eec.77d9f","type":"mqtt in","z":"a0a22bbe.4dd42","name":"","topic":"FOB","qos":"2","datatype":"auto","broker":"3d22a2f.7bec8de","x":130,"y":140,"wires":[["d9dae4cd.dd58b8"]]},{"id":"d5e82719.0d70b8","type":"mqtt in","z":"a0a22bbe.4dd42","name":"","topic":"TRADE ","qos":"2","datatype":"auto","broker":"3d22a2f.7bec8de","x":130,"y":200,"wires":[[]]},{"id":"53b5c860.6ecf","type":"mqtt in","z":"a0a22bbe.4dd42","name":"","topic":"FOB _and_TRADE","qos":"2","datatype":"auto","broker":"3d22a2f.7bec8de","x":170,"y":260,"wires":[[]]},{"id":"b855f07b.77b14","type":"mqtt out","z":"a0a22bbe.4dd42","name":"","topic":"MATCH","qos":"","retain":"","broker":"3d22a2f.7bec8de","x":1300,"y":200,"wires":[]},{"id":"92b43cac.dee5e","type":"sqlite","z":"a0a22bbe.4dd42","mydb":"1a9ea8ca.835eef","sqlquery":"msg.topic","sql":"SELECT * FROM NCS WHERE Person_ID='{{payload}}';","name":"SQLITE3","x":800,"y":140,"wires":[["8bcbf413.dbee18","914a2434.2aeb98"]]},{"id":"d9dae4cd.dd58b8","type":"change","z":"a0a22bbe.4dd42","name":"","rules":[{"t":"set","p":"id","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":140,"wires":[["84343c5c.a4473","48d9502d.46ce78"]]},{"id":"84343c5c.a4473","type":"debug","z":"a0a22bbe.4dd42","name":"Debug_tchange1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":450,"y":80,"wires":[]},{"id":"48d9502d.46ce78","type":"template","z":"a0a22bbe.4dd42","name":"","field":"topic","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"SELECT Person_ID FROM NCS \nWHERE Person_ID='{{payload}}';","output":"str","x":560,"y":140,"wires":[["f8041486.46d2d","92b43cac.dee5e"]]},{"id":"f8041486.46d2d","type":"debug","z":"a0a22bbe.4dd42","name":"Debug23","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":680,"y":80,"wires":[]},{"id":"8bcbf413.dbee18","type":"switch","z":"a0a22bbe.4dd42","name":"","property":"payload","propertyType":"msg","rules":[{"t":"empty"},{"t":"nempty"}],"checkall":"true","repair":false,"outputs":2,"x":890,"y":220,"wires":[["15b45169.1dd22f"],["3e0f30eb.c40078"]]},{"id":"15b45169.1dd22f","type":"change","z":"a0a22bbe.4dd42","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"CR_FAIL","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1080,"y":140,"wires":[["b855f07b.77b14"]]},{"id":"3e0f30eb.c40078","type":"change","z":"a0a22bbe.4dd42","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"CR_SUCCESS","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1080,"y":280,"wires":[["b855f07b.77b14","bee6eb72.e9f828"]]},{"id":"bee6eb72.e9f828","type":"debug","z":"a0a22bbe.4dd42","name":"Debug2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1180,"y":360,"wires":[]},{"id":"914a2434.2aeb98","type":"debug","z":"a0a22bbe.4dd42","name":"debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":910,"y":60,"wires":[]},{"id":"3d22a2f.7bec8de","type":"mqtt-broker","z":"","name":"","broker":"tcp://mqtt.eclipse.org","port":"1883","clientid":"NCS_Client03","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"1a9ea8ca.835eef","type":"sqlitedb","z":"","db":"/var/tmp/NCS.db","mode":"RWC"}]

```

---

<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 August 2020 12:09 UTC](https://discourse.nodered.org/t/error-sqlite-error-no-such-table-ncs/32037/15 "2020-08-26T12:09:07Z")

</div>

[Remember to use the `</>` option when inserting flows so they can be imported - I have fixed your post]

Are you sure that the database exists on the machine that is running Node-RED? and that it exists in that location `/var/tmp/NCS.db'?

---

<div class="post-metadata">

**Author:** ![shipra](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shipra](https://discourse.nodered.org/u/shipra)\
**Post date:** [26 August 2020 12:11 UTC](https://discourse.nodered.org/t/error-sqlite-error-no-such-table-ncs/32037/16 "2020-08-26T12:11:38Z")

</div>

Thank you for fixing that first.I will remember that in future.  
Sir I am not sure please tell how to fill that sqlite edit node.

---

<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 August 2020 12:18 UTC](https://discourse.nodered.org/t/error-sqlite-error-no-such-table-ncs/32037/17 "2020-08-26T12:18:06Z")

</div>

> [@shipra](#):
>
> Sir I am not sure please tell how to fill that sqlite edit node.

If NR is running on a couputer other than the one you are sitting in front of, you need to SSH into that machine so you can go to the `/var/tmp` directory and see if the file `NCS.db` resides there.

if it does, then you should start sqlite3 and check to see if the NCS table exists in it.

---

<div class="post-metadata">

**Author:** ![shipra](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@shipra](https://discourse.nodered.org/u/shipra)\
**Post date:** [26 August 2020 12:48 UTC](https://discourse.nodered.org/t/error-sqlite-error-no-such-table-ncs/32037/18 "2020-08-26T12:48:51Z")

</div>

Sir Node red is running on my machine same machine where database is there

---

<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 August 2020 13:01 UTC](https://discourse.nodered.org/t/error-sqlite-error-no-such-table-ncs/32037/19 "2020-08-26T13:01:34Z")

</div>

What is the OS of tyour machine?

---

<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 August 2020 13:05 UTC](https://discourse.nodered.org/t/error-sqlite-error-no-such-table-ncs/32037/20 "2020-08-26T13:05:15Z")

</div>

Also how did you install node red? Are you using Docker?

---

<div class="post-metadata">

**Author:** ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)\
**Post date:** [26 August 2020 13:34 UTC](https://discourse.nodered.org/t/error-sqlite-error-no-such-table-ncs/32037/21 "2020-08-26T13:34:04Z")

</div>

> [@shipra](#):
>
> ```auto
> sqlite> SELECT * FROM NCS;
> 1| | | |04222436| |04222536| | |
> 1| | | |04222437| |04222537| | |
> 
> ```

Looking at your flow .. so your database in called **NCS** and also your table is called **NCS**??

![Screenshot_2020-08-26 Node-RED 192 168 1 160](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/c/ccb20e643b5abd809ef21f7e6e44aad9ab2aa694.png)

If the above information is correct try this flow :

```auto
[{"id":"fc0817f2.eb8d88","type":"mqtt in","z":"71a01b62.49e8f4","name":"","topic":"FOB","qos":"2","datatype":"auto","broker":"db872a3f.794be8","x":130,"y":140,"wires":[["fc9a9295.550d4","751d3139.371318"]]},{"id":"4423ad05.f3097c","type":"mqtt in","z":"71a01b62.49e8f4","name":"","topic":"TRADE ","qos":"2","datatype":"auto","broker":"db872a3f.794be8","x":130,"y":200,"wires":[[]]},{"id":"4fbb15d2.3417b4","type":"mqtt in","z":"71a01b62.49e8f4","name":"","topic":"FOB _and_TRADE","qos":"2","datatype":"auto","broker":"db872a3f.794be8","x":170,"y":260,"wires":[[]]},{"id":"8b23402b.f70838","type":"mqtt out","z":"71a01b62.49e8f4","name":"","topic":"MATCH","qos":"","retain":"","broker":"db872a3f.794be8","x":1300,"y":200,"wires":[]},{"id":"940db604.f95","type":"sqlite","z":"71a01b62.49e8f4","mydb":"b8fde1fc.05ebf8","sqlquery":"msg.topic","sql":"SELECT * FROM NCS WHERE Person_ID='{{payload}}';","name":"SQLITE3","x":800,"y":140,"wires":[["9db9f0d4.7ca018","968baba6.9696b"]]},{"id":"fc9a9295.550d4","type":"change","z":"71a01b62.49e8f4","name":"","rules":[{"t":"set","p":"id","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":140,"wires":[["691f9f1c.710b58","bde3e26b.8bc518"]]},{"id":"691f9f1c.710b58","type":"debug","z":"71a01b62.49e8f4","name":"Debug_tchange1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":450,"y":80,"wires":[]},{"id":"3a16c607.9f476a","type":"debug","z":"71a01b62.49e8f4","name":"Debug23","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":680,"y":80,"wires":[]},{"id":"9db9f0d4.7ca018","type":"switch","z":"71a01b62.49e8f4","name":"","property":"payload","propertyType":"msg","rules":[{"t":"empty"},{"t":"nempty"}],"checkall":"true","repair":false,"outputs":2,"x":890,"y":220,"wires":[["8aa15a33.6b4bf8"],["620b6a11.bf0c44"]]},{"id":"8aa15a33.6b4bf8","type":"change","z":"71a01b62.49e8f4","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"CR_FAIL","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1080,"y":140,"wires":[["8b23402b.f70838"]]},{"id":"620b6a11.bf0c44","type":"change","z":"71a01b62.49e8f4","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"CR_SUCCESS","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1080,"y":280,"wires":[["8b23402b.f70838","ffb44bbd.548d2"]]},{"id":"ffb44bbd.548d2","type":"debug","z":"71a01b62.49e8f4","name":"Debug2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1180,"y":360,"wires":[]},{"id":"968baba6.9696b","type":"debug","z":"71a01b62.49e8f4","name":"debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":910,"y":60,"wires":[]},{"id":"c762a68f.5d75a8","type":"inject","z":"71a01b62.49e8f4","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"andy","payloadType":"str","x":430,"y":240,"wires":[["bde3e26b.8bc518"]]},{"id":"bde3e26b.8bc518","type":"function","z":"71a01b62.49e8f4","name":"","func":"let newMsg = {};\nnewMsg.topic = `SELECT Person_ID FROM NCS WHERE Person_ID='${msg.payload}'`;\nreturn newMsg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":570,"y":160,"wires":[["940db604.f95","3a16c607.9f476a"]]},{"id":"751d3139.371318","type":"debug","z":"71a01b62.49e8f4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":240,"y":80,"wires":[]},{"id":"68eb018b.df0f58","type":"template","z":"71a01b62.49e8f4","name":"","field":"topic","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"SELECT Person_ID FROM NCS \nWHERE Person_ID='{{payload}}';","output":"str","x":600,"y":380,"wires":[[]]},{"id":"db872a3f.794be8","type":"mqtt-broker","z":"","name":"","broker":"tcp://mqtt.eclipse.org","port":"1883","clientid":"NCS_Client03","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"b8fde1fc.05ebf8","type":"sqlitedb","z":"","db":"/var/tmp/NCS.db","mode":"RWC"}]

```

I replaced your template node with a function node because your template node was outputing this

![Screenshot_2020-08-26 Node-RED 192 168 1 1602](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/8/c88a568710c0b688a123347a6da193caf4fd740c.png)

The enter (change of line) you had may have caused the problem

[Next page](https://discourse.nodered.org/t/error-sqlite-error-no-such-table-ncs/32037.md?page=2)
