Mssql not sending data to database using mustache format

Hello there,

I'm trying to send some data to my database with MSSQL. I achieved to send data using the node, but when I need to send data from the flow, it is not working.
I have OPCUA node that retrieves a bool, and i need to send it to the database.

The request looks like this, and the '5' is working, but not the '{{{msg.payload}}}' :

INSERT INTO [GestionInfo].[dbo].[sfp] ("Id_Palette","Presence_Palette") values ('5','{{{msg.payload}}}')

image

Thanks for your help.

Assuming you are using mssql-plus, simply use the parameters to specify the value (parameters also protect you from SQL injection)

It is the normal MSSQL contrib, since with MSSQL + my node looks like this :
image

That node is over 7 years old, uses old libraries (with CVE issues) and has a number of known bugs and last, but not least, does not have the additional features that make mssql-plus the best SQL node in the catalog.

I suggest you remove that and add the newer/better one and use parameters.

You have 2 choices to acheive that ^

  1. remove all traces of mssql from your flows
  2. remove node-red-contrib-mssql via palette manager
  3. install node-red-contrib-mssql-plus via palette manager
  4. restart node-red
  5. add the SQL nodes back into your flows

OR

  1. stop node-red
  2. run npm remove node-red-contrib-mssql (in a terminal, in ~/.node-red)
  3. run npm install node-red-contrib-mssql-plus (in a terminal, in ~/.node-red)
  4. start node-red

The 2nd version is my recommendation but not everyone is comfortable with command line.

Wait, do you have both node-red-contrib-mssql AND node-red-contrib-mssql-plus installed?

They clash and should NOT both be installed.

I do not, I deleted contrib-mssql before installing mssql-plus just to show you that the last one is not working

ok, so you are sorted now?

Thanks ! it's working now with your solution.
Have a great day

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