Registry / database / node-red-contrib-mssql-plus

node-red-contrib-mssql-plus

JSON →
library0.13.1jsnpmunverified

Node-RED node for executing queries, stored procedures, and bulk inserts on Microsoft SQL Server and Azure SQL databases (SQL2000–SQL2022). Current stable version is 0.13.1. Released on npm with no fixed cadence; maintained as active. Key differentiator: includes pre-built Linux TDS drivers so no ODBC driver setup is needed. Supports environment variable interpolation, Mustache templates in queries, input and output parameters, multiple result sets, and error handling via catch node or msg.error. Requires Node-RED and Node.js >=18.

npm install node-red-contrib-mssql-plus
INSTALL
IMPORT
SIG · NODE-RED-CONTRIB-M
N
node-red-contrib-mssql-plus
databasejavascriptv0.13.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

MSSQL node (Node-RED)
✓ Drag 'MSSQL' node from palette or import flow JSON with type: 'MSSQL'
✗ Using 'node-red-contrib-mssql-plus' as a regular npm module (it is a Node-RED plugin, not a JS library).
This package provides Node-RED nodes, not programmable exports. Use within Node-RED flows.
Configuration node (MSSQL config)
✓ Add a 'MSSQL' config node (type: 'MSSQL config') with server, database, auth details.
✗ Directly hardcoding credentials in flow nodes without using config node.
Config nodes can use environment variables via triple-moustache syntax, e.g., {{{SQL_IP}}}.
Query parameters
✓ Define parameters in the node's 'Parameters' table or via msg.params.
✗ Using string interpolation inside SQL (risks SQL injection). Use @paramName placeholders.
Parameters can come from msg, flow, or global context, as well as static values.

Creates a Node-RED inject node that triggers a SELECT query on a MSSQL config node, outputting to debug.

// Example Node-RED flow JSON for a simple query inject -> MSSQL -> debug [{"id":"1","type":"inject","name":"trigger","payload":"","repeat":"","once":false,"x":100,"y":100,"wires":[["2"]]},{"id":"2","type":"MSSQL","name":"query","mssqlCN":"3","outField":"payload","returnType":"1","throwErrors":"0","query":"SELECT GETDATE() AS now","modeOpt":"","modeOptType":"query","queryOpt":"","queryOptType":"editor","paramsOpt":"","paramsOptType":"editor","params":[],"x":300,"y":100,"wires":[["4"]]},{"id":"3","type":"MSSQL config","name":"myserver","server":"{{{$SQL_SERVER}}}","port":"1433","encrypt":"true","trustServerCertificate":"false","authentication":"azure-active-directory-password","username":"{{{$SQL_USER}}}","password":"{{{$SQL_PASS}}}","database":"{{{$SQL_DB}}}","domain":"","domainUserName":"","domainPassword":"","connectionTimeout":"15","requestTimeout":"15","sslCert":"","sslHost":"","sslCa":"","options":""},{"id":"4","type":"debug","name":"output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":500,"y":100,"wires":[]}]
Debug
Known issues
breakingRequires Node.js >=18 (since version 0.13.0).
fix
Upgrade Node.js to version 18 or later.
affects: >=0.13.0
deprecatedThe old 'MSSQL' node (from node-red-contrib-mssql) is deprecated. Use this plus variant instead.
fix
Replace node-red-contrib-mssql with node-red-contrib-mssql-plus; adjust configuration accordingly.
gotchaMustache rendering in SQL queries uses triple braces {{{...}}} not double braces {{...}}.
fix
Use {{{...}}} for variable interpolation; {{...}} will not render.
gotchaParameters defined in the node UI override msg.params. Ensure no conflicting definitions.
fix
Remove static parameter definitions if sending via msg.params, or remove msg.params if using UI parameters.
breakingReturn type options changed: '1' returns array of recordsets, '2' returns single object, etc. Check documentation.
fix
Set 'returnType' field: 1 for multiple recordsets, 2 for first row only, etc.
Errors
Common errors & fixes
Error: Failed to connect to server: ...
Connection configuration incorrect or server unreachable (network/firewall).
fix
Verify server address, port, credentials, and network access. Check if TLS encryption is required.
ReferenceError: {{{sql_ip}}} is not defined
Environment variable not set or triple moustache syntax wrong.
fix
Define all used env vars in Node-RED environment or provide default values. Use correct syntax: {{{ENV_VAR}}}.
TypeError: msg.payload is not iterable
Bulk insert expects an array of objects but received something else.
fix
Ensure msg.payload is an array of objects (rows) before bulk insert node.
The server did not respond in a timely fashion
Connection or request timeout reached.
fix
Increase 'connectionTimeout' and 'requestTimeout' in config node, or optimize query performance.
Upgrade
Version history
0.13.1latest on npm
Audit
Dependencies
node-redrequiredThis is a Node-RED node; it only runs inside a Node-RED instance.
mssqlrequiredCore database driver for SQL Server connections.
tediousoptionalTDS protocol implementation used by mssql; may be included as a dependency of mssql.
Agent activity
7 hits · last 30 days
node
6
Resources
node-red-contrib-mssql-plus — npm install node-red-contrib-mssql-plus · libregistry