Can't upload some values to MSSQL

hi, when i try to upload a value to my database I get this message in my debug window:

RequestError: Could not find stored procedure 'true'.

has anyone got a idea?

too little information. pls share the code

database flow.txt (69.2 KB)
i had to put the flow in a text flow

I am so sorry, i am not fluent with MSSQL, i use MySQL and had working examples
Someone else will definitely help, keep watching this space.

No worries. Thanks for taking a look at my code.

If you edit the title of the thread and include MSSQL in it then it will be more likely that someone who knows about that will see it. I don't use it, but I understand that recommended node to use is node-red-contrib-mssql-plus (or a similar name).

hi, thanks for the tip, I changed the titel. I've got this library installed:

node-red-contrib-mssql

And i can upload some values to the database but i can't upload everything. I suspect an error in my query but i'm not entirely sure.

Look at the node's page in the flows site and you will see that it is ancient and, by going to the github page linked there you will see that no longer even exists.

Pretty sure that doesnt support stored procedures. (and its old and has known bugs)

node-red-contrib-mssql-plus has direct support for stored procedures AND parameters (to reduce chances of SQL injection).

Here is an example: MSSQL-PLUS - passing array to UDT parameter (TVP param in a stored procedure) - #22 by Steve-Mcl

right. have installed the library you recommended and it is doing something. however i think im doing something wrong. i usume i need to format the data as you showed in the thread you linked in your comment but i don't really know where i should start.

EDIT: i changed the input value from a varchar to an int and now the Invalid template! Template should be a "string" but "number" was recieved error code is gone but the other ones remain.

You will have to share what is entered in the MSSQL-PLUS node and put a debug node BEFORE and AFTER the MSSQL node for me to be able to have any idea.

MSSQL-PLUS node:

setup:

output:

im still getting a formatting error for some reason. I solved this error the other day. but i don't think solving that will solve all of my problems.
ill show you a picture of my database setup aswell:
image

if you need me to translate some of the dutch words I used, just tell me.

So it looks like you are generating a dynamic SQL command in the function node however you have the query set to editor.

It would make more sense to enter the SQL in the SQL node and make use of parameters (to negate any SQL injection) however for the sake of this simplicity, you need to set the query to msg.payload or msg.topic (to match wherever you set the query in your function node)

this is what i came up with:


I put the query in the sql node like you said and i seperated the if statement:
BEFORE:

AFTER:

but the if statement doesn't work.

i've got a series of buttons and tabs in my dasboard which collect data, this data needs to be pushed to the database IF button 'toevoegen' (this means 'add' in dutch) is pressed.

this is how i define the 'toevoegen' button:
image

If you have the query set to editor you cannot pass a query into the node.

What I was saying in the previous post was to use the parameters.

Here is an example that explains how it works...

This seems to be working. But before I'll mark your reply as the solution I'll have to do some tests. But for now thanks a million for your time and patience.

I'll let you know when I'm done.

right, the database side is working as far as I can see. But the if statement doesn't work.

this is the code in the if stat node
if(flow.get('Toevoegen')==true) { msg.payload = true; } return msg;
and this is what the flow looks like:

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