Hello, I'working on project where I read data from energy meter and I should send them on MSSQL.
My problem is in MSSQL node. I have two inputs but when I have in query this line
SET @total_Ea_Import = {{{payloadTotal_Ea_Import}}};
It show me this error
"RequestError: Incorrect syntax near ';'."
Here is my whole query from MSSQL:
DECLARE @total_Ea_Import float
DECLARE @total_Er_Import float
SET @total_Ea_Import = {{{payloadTotal_Ea_Import}}};
SET @total_Er_Import = {{{payloadTotal_Er_Import}}};
INSERT INTO iEM3000
(Total_Ea_Import,Total_Er_Import)
VALUES
(@total_Ea_Import,@total_Er_Import )
The weirdest thing is if I instead of query I post I use this query:
DECLARE @total_Ea_Import float
DECLARE @total_Er_Import float
SET @total_Ea_Import = {{{payloadTotal_Er_Import}}};//here is change, instead of Ea is Er
SET @total_Er_Import = {{{payloadTotal_Er_Import}}};
INSERT INTO iEM3000
(Total_Ea_Import,Total_Er_Import)
VALUES
(@total_Ea_Import,@total_Er_Import )
It works but I've just got the same data twice. So I think the problem is in that line with Total Active Energy Import->Float32->Ea Import
And I tried to copy everything from that downside line that work and just change Er and Ea but still don't work.
The MSSQL node won't magically join the two messages together.
It just sees a message does it stuff and them when the next message comes in it does it stuff again.
You need to Join the two messages together before the MSSQL node take a look at the JOIN node.
I don't need join them together. I need to send data coming from node Ea Import to column (in database) called Total_Ea_Import and data coming from node Er Import to column (in database) called Total_Er_Import. But that line in query
SET @total_Ea_Import = {{{payloadTotal_Ea_Import}}};
can't set value from payloadtotal_Ea_Import to @total_Ea_Import.
When I deploy it without this line, it works but in column Total_Ea_Import is null and Total_Er_Import is correct. So I believe the problem is in that line or in nodes Total Active Energy Import->Float32->Ea Import.
Okey, that make sense! I'll try that JOIN node.
I also watched the video from Opto (https://www.youtube.com/watch?v=cO8QpyUnEwg) and there is no JOIN node but I'll try something with that.
Actually I'm not sure that is going to solve the problem, given your current flow (but only seeing picture its rather difficult to know exactly what you are doing)
But you can't get data from two separate inputs and assume they will be joined which is what you appear to be doing. Perhaps you can link to the point in the video where two inputs are merged?
Yeah. there are not two inputs. I overlooked. Sorry for wasting your time with that video. But I think I know what you mean so I'll try somehow join them together and we'll see.