# SQL-string with appendix

**URL:** <https://discourse.nodered.org/t/sql-string-with-appendix/95286>\
**Category:** General\
**Tags:** function-node\
**Created:** [10 February 2025 14:51 UTC](https://discourse.nodered.org/t/sql-string-with-appendix/95286 "2025-02-10T14:51:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Owler](https://avatars.discourse-cdn.com/v4/letter/o/a587f6/32.png) [@Owler](https://discourse.nodered.org/u/Owler)\
**Post date:** [10 February 2025 14:51 UTC](https://discourse.nodered.org/t/sql-string-with-appendix/95286/1 "2025-02-10T14:51:56Z")

</div>

Hello,  
I try to save values from a smartmeter into a Mysql database.  
The smartmeter is a ISKRA eHZ-EDL .  
I can see the values at a dashboard so far so good.  
Now write the values into to the database did not work.  
I get 3 values which are in an array. With a function node I assign the values to 3 variables  
This variables are used to fill a SQL string.  
In a debug node I see the complete string,

insert into strom (AktVerbrauch, netzbezug, Netzeinspeisung , erfasst, jahr,monat,tag, wochentag ,zeit ) values(158,7919.4357,16755.7367,"2025-2-10 15:42:10",2025,2,10,15,2025-2-10,15:42:10) : msg.payload : array[3]\*

The problem is that the string has an appendix like this : msg.payload : array[3]\*  
My question how can I remove the appendix.  
Who can give me an advice Thank you.

Owler

---

<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:** [10 February 2025 15:45 UTC](https://discourse.nodered.org/t/sql-string-with-appendix/95286/2 "2025-02-10T15:45:30Z")

</div>

Welcome to the forum @Owler

For MySQL you build your query as msg.topic.

By default the debug node displays just msg.payload but it uses the value of msg.topic as a label.

So what you are just seeing is perfectly OK, `: msg.payload : array[3]` is not part of the query.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/d/0d47f1cd02e3267aece648530dfa24ca19573b81.png)

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [10 February 2025 15:52 UTC](https://discourse.nodered.org/t/sql-string-with-appendix/95286/3 "2025-02-10T15:52:06Z")

</div>

> [@Owler](#):
>
> 15,2025-2-10,15:42:10)

This section of your query does not look right, should be some quotes in there.

There is also 9 columns and 10 values in the query.

---

<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:** [10 February 2025 16:06 UTC](https://discourse.nodered.org/t/sql-string-with-appendix/95286/4 "2025-02-10T16:06:21Z")

</div>

> [@Owler](#):
>
> The problem is that the string has an appendix like this : msg.payload : array[3]\*

I think you are mis-reading the debug output. To make it clearer, set the debug node to Output Complete Message and you will see more clearly what is there.

---

<div class="post-metadata">

**Author:** ![Owler](https://avatars.discourse-cdn.com/v4/letter/o/a587f6/32.png) [@Owler](https://discourse.nodered.org/u/Owler)\
**Post date:** [10 February 2025 19:16 UTC](https://discourse.nodered.org/t/sql-string-with-appendix/95286/5 "2025-02-10T19:16:15Z")

</div>

Hallo

Thank you all who give me an advice.  
I cleared the SQL string and it works,

Owler

---

<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:** [11 May 2025 19:16 UTC](https://discourse.nodered.org/t/sql-string-with-appendix/95286/6 "2025-05-11T19:16:15Z")

</div>

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