# Node-red-node-sqlite - "msg.topic" size restriction?

**URL:** <https://discourse.nodered.org/t/node-red-node-sqlite-msg-topic-size-restriction/87361>\
**Category:** General\
**Tags:** sqlite\
**Created:** [20 April 2024 10:35 UTC](https://discourse.nodered.org/t/node-red-node-sqlite-msg-topic-size-restriction/87361 "2024-04-20T10:35:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MikeG996](https://avatars.discourse-cdn.com/v4/letter/m/5daacb/32.png) [@MikeG996](https://discourse.nodered.org/u/MikeG996)\
**Post date:** [20 April 2024 10:35 UTC](https://discourse.nodered.org/t/node-red-node-sqlite-msg-topic-size-restriction/87361/1 "2024-04-20T10:35:02Z")

</div>

I have a successful node which inserts data into a SQLite DB using the "msg.topic = "INSERT INTO [blah].." method.

When I tried to replicate this in a node which generates a larger array of columns/values, it failed. I noticed that "msg.topic" is defined in the returned error as "string[256] however my "msg.topic" is frequently over 520 characters (I think I see where the problem lies!).

Can anyone advise a better way to insert this data into the table please?

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [20 April 2024 11:14 UTC](https://discourse.nodered.org/t/node-red-node-sqlite-msg-topic-size-restriction/87361/2 "2024-04-20T11:14:53Z")

</div>

Hi @MikeG996, welcome to the forum.

There does not seem to be a 256 character limit to msg.topic for the INSERT statement, my flow is happily executing 400+ character INSERTs.  
Perhaps the node only returns 256 characters in the error message.

> [@MikeG996](#):
>
> Can anyone advise a better way to insert this data into the table please?

Can you show us an example of your msg.topic before you send it to SQLite?

Feed it to a debug node, then use the "Copy value" button in the debug panel and the `</>` button here to paste it into your reply.

The error message would be good to see too.

---

<div class="post-metadata">

**Author:** ![MikeG996](https://avatars.discourse-cdn.com/v4/letter/m/5daacb/32.png) [@MikeG996](https://discourse.nodered.org/u/MikeG996)\
**Post date:** [21 April 2024 07:27 UTC](https://discourse.nodered.org/t/node-red-node-sqlite-msg-topic-size-restriction/87361/3 "2024-04-21T07:27:43Z")

</div>

Hi @jbudd , many thanks for your reply.

I actually resolved the issue by moving the code to the "Prepared Statement" method (with a few tweaks). I must have made a mistake somewhere in the "msg.topic" approach.

Thanks again for your reply - I really appreciate your friendly, helpful & detailed response.

Regards,  
Mike

---

<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:** [5 May 2024 07:28 UTC](https://discourse.nodered.org/t/node-red-node-sqlite-msg-topic-size-restriction/87361/4 "2024-05-05T07:28:19Z")

</div>

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