Using SQL with Node-red

Have a problem where I need to read the On Change ( new rows) from an SQL table (MS SQL) I have managed to read all records. but as the table grows the response grows.

Problem is I want to read a row in table (last) or all the rows written in last 10 seconds ad send out as an MQTT message. Don't want to send out all lines

Query I am using is

Select * from Events

I tried to put a where condition and it won't accept even though the query is valid in Microsoft SQL Workbench thing

SELECT * from Events WHERE EventsID > 12

Ideally the "12" should be the last record of the last read.

(using the gomake/node-red-contrib-mssql-jb SQL driver)

add to the sql command

ORDER BY EventsID DESC

and

LIMIT 10

(for the last 10)

Are you using node-red-contrib-mssql-plus?

Using - gomake/node-red-contrib-mssql-jb

Be aware, the node-red-contrib-mssql-jb node hasn't been updated in almost 3 years, and it's git repo has now been removed/deleted/hidden.
It also has zero stars in the node-RED ratings.

I would look for another contrib node that fulfils your needs.

I was starting to think the same seems not to support the WHERE condition

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