# Node-red-contrib-mssql-plus =\> value in database is empty

**URL:** <https://discourse.nodered.org/t/node-red-contrib-mssql-plus-value-in-database-is-empty/52205>\
**Category:** General\
**Tags:** database\
**Created:** [14 October 2021 09:53 UTC](https://discourse.nodered.org/t/node-red-contrib-mssql-plus-value-in-database-is-empty/52205 "2021-10-14T09:53:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexandre1987](https://avatars.discourse-cdn.com/v4/letter/a/58f4c7/32.png) [@Alexandre1987](https://discourse.nodered.org/u/Alexandre1987)\
**Post date:** [14 October 2021 09:53 UTC](https://discourse.nodered.org/t/node-red-contrib-mssql-plus-value-in-database-is-empty/52205/1 "2021-10-14T09:53:30Z")

</div>

Processing: Nodered.pdf...

Hello,

I am a new user of Nodered and am starting to create my first flux.

I am having difficulty with the "node-red-contrib-mssql-plus" node, I can connect to my table, a row is created but my values ​​don’t update. The result is empty.

When debugging after my mssql-plus node, I have this return as a value:

INSERT INTO [GPAOSQL]. [GPSQL]. [Ab\_edi\_OT\_CCF] (ts\_pos\_wo\_id, wo\_instruction, type, category, reason)

VALUES ('', '', '', '', '')

I found a topic with a similar problem but I cannot find where the error is.

If anyone had an example flux with an update of the values ​​in a database, that would be really great.

I thank you in advance.

Alex

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [14 October 2021 10:57 UTC](https://discourse.nodered.org/t/node-red-contrib-mssql-plus-value-in-database-is-empty/52205/2 "2021-10-14T10:57:34Z")

</div>

You are likely not populating the values correctly.

- Put a Debug node before and after the SQL node (set it to show full message)
- Show us what is in the query.

---

<div class="post-metadata">

**Author:** ![Alexandre1987](https://avatars.discourse-cdn.com/v4/letter/a/58f4c7/32.png) [@Alexandre1987](https://discourse.nodered.org/u/Alexandre1987)\
**Post date:** [14 October 2021 11:09 UTC](https://discourse.nodered.org/t/node-red-contrib-mssql-plus-value-in-database-is-empty/52205/3 "2021-10-14T11:09:33Z")

</div>

Hi Steve-Mcl, thank's for your response.

My debug before SQL is:

14/10/2021, 13:01:32[node: 14b54ae5.065de5](http://10.10.1.224:1880/admin/)  
msg.payload : array[1]  
array[1]  
0: object  
ts\_pos\_wo\_id: "67868-8998"  
wo\_instruction: "CREATE"  
type: "POST"  
category: "POST"  
reason: 0

My debug after SQL is:

msg : Object  
object  
\_msgid: "5c44203e.ccff2"  
payload: undefined  
topic: ""  
statusCode: 200  
responseUrl: "[https://virtserver.swaggerhub.com/Clear-Channel/apist/v3/v3/OTsortant](https://virtserver.swaggerhub.com/Clear-Channel/apist/v3/v3/OTsortant)"  
redirectList: array[0]  
headers: object  
query: string  
INSERT INTO [dbo].[ab\_edi\_OT\_CCF] (ts\_pos\_wo\_id,wo\_instruction,type,category,reason)  
VALUES ('','', '','','')  
queryMode: "query"  
queryParams: array[0]  
sqlInfo: array[0]

My request SQL in SQL node is:

INSERT INTO [dbo].[ab\_edi\_OT\_CCF] (ts\_pos\_wo\_id,wo\_instruction,type,category,reason)  
VALUES ('{{{payload.ts\_pos\_wo\_id}}}','{{{payload.wo\_instruction}}}', '{{{payload.type}}}','{{{payload.category}}}','{{{payload.reason}}}')

I think, my problematic is "payload: undefined", but i don't now how i can define payload?

Thank's a lot

Alex

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [14 October 2021 11:20 UTC](https://discourse.nodered.org/t/node-red-contrib-mssql-plus-value-in-database-is-empty/52205/4 "2021-10-14T11:20:36Z")

</div>

Hi, so a couple of things first.

1. Please post code between backticks  
`````  
`like this`  
`````

2. When copying values from the debug sidebar, use the "Copy Value" button that appears under your mouse cursor when you hover over the message  
 ![BX00Cy7yHi](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/d/bd1f333a9e043b061b39917c328b0094d3e52d30.gif)

* * *

On you your issue...

The debug BEFORE SQL shows payload is an `array` but in your SQL, you try to access `payload.ts_pos_wo_id` - an array is accessed by `[]` square brackets.

To simplify things (and avoid mistakes) use the "Copy Path" button that appears under your mouse cursor when you hover over the item of interest & use that.

* * *

Lastly,

I **strongly** recommend you use the parameters instead of {{{mustache}}} - this will protect your database against SQL injection.

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

---

<div class="post-metadata">

**Author:** ![Alexandre1987](https://avatars.discourse-cdn.com/v4/letter/a/58f4c7/32.png) [@Alexandre1987](https://discourse.nodered.org/u/Alexandre1987)\
**Post date:** [14 October 2021 12:19 UTC](https://discourse.nodered.org/t/node-red-contrib-mssql-plus-value-in-database-is-empty/52205/5 "2021-10-14T12:19:05Z")

</div>

Really, thank you Steve-Mcl,

It was the solution

Thank's

Alex

---

<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:** [28 October 2021 12:19 UTC](https://discourse.nodered.org/t/node-red-contrib-mssql-plus-value-in-database-is-empty/52205/6 "2021-10-28T12:19:22Z")

</div>

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