# Send Dynamic Numeric Value(Recieve from PLC) to MSSQL

**URL:** <https://discourse.nodered.org/t/send-dynamic-numeric-value-recieve-from-plc-to-mssql/15427>\
**Category:** General\
**Created:** [11 September 2019 15:08 UTC](https://discourse.nodered.org/t/send-dynamic-numeric-value-recieve-from-plc-to-mssql/15427 "2019-09-11T15:08:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![alpesh](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@alpesh](https://discourse.nodered.org/u/alpesh)\
**Post date:** [11 September 2019 15:08 UTC](https://discourse.nodered.org/t/send-dynamic-numeric-value-recieve-from-plc-to-mssql/15427/1 "2019-09-11T15:08:04Z")

</div>

I am recieving some DINT value from PLC which I want to send MSSQL database. For that I am using INSERT. But i can only send String Value not any Dynamic value.  
I want to PLC value to MSSQL.

INSERT INTO [Dev].[dbo].[MQTTData] (Topic,Payload) VALUES ('alpesh','Sensor')

In this How i can Map my PLC sensor value to Payload.

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [11 September 2019 15:10 UTC](https://discourse.nodered.org/t/send-dynamic-numeric-value-recieve-from-plc-to-mssql/15427/2 "2019-09-11T15:10:55Z")

</div>

If you search on [flows.nodered.org](http://flows.nodered.org) for "sql" you should find example flows you can import to see the correct syntax.

It's also worth reading the page in the documentation on "working with messages"

---

<div class="post-metadata">

**Author:** ![alpesh](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@alpesh](https://discourse.nodered.org/u/alpesh)\
**Post date:** [11 September 2019 15:13 UTC](https://discourse.nodered.org/t/send-dynamic-numeric-value-recieve-from-plc-to-mssql/15427/3 "2019-09-11T15:13:51Z")

</div>

Sir,I have tried a lot. But i could not MAP my PLC variable to SQL

---

<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:** [11 September 2019 15:35 UTC](https://discourse.nodered.org/t/send-dynamic-numeric-value-recieve-from-plc-to-mssql/15427/4 "2019-09-11T15:35:12Z")

</div>

If you are using the latest version of MSSQL-plus node it has several examples in the built in help (I know, I wrote them).

Here is an example...

```auto
INSERT INTO [Dev].[dbo].[MQTTData]
 (Topic,Payload) 
VALUES ('{{topic}}',{{payload}})

```

---

<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:** [11 September 2019 15:37 UTC](https://discourse.nodered.org/t/send-dynamic-numeric-value-recieve-from-plc-to-mssql/15427/5 "2019-09-11T15:37:25Z")

</div>

Additionally, you can leave the SQL empty and send a SQL statement into the MSSQL-plus node.

It's all there in the built in help (right hand side bar under the "i" into tab) and in the [readme](https://www.npmjs.com/package/node-red-contrib-mssql-plus)
