Not certain if I have the right area for this. I am having a heck of time trying to get a string value from an ncd device to a mssql database. The specific value I am attempting to get into the db is data.sensor_type. I am running the latest supported versions of node-red, node.js, and mssql plus node.
The error I am receiving from the node is calling it an invalid column, but I believe the sql syntax is correct.
I can force a string value (when entered directly into the sql syntax) and it works just fine getting into the db. All numerical values go into the db just fine. I have tried sensor_type (as string value) and it gives me the same type of error from the node.
Sql Syntax in the MSSQL node:
INSERT INTO [temperaturehumidity] (temp,humidity,nodeID,voltage,SensorName) VALUES ({{{payload.temperature}}}*1.8+32,{{{payload.humidity}}},{{{data.nodeId}}},{{{data.battery}}},{{{data.sensor_name}}})
Flow:
[{"id":"24a7e6c1.bbd94a","type":"ncd-wireless-node","z":"a41e8b1b.0dadc","name":"Room 1 Encapsulation Sensor (Semi)","connection":"99bc8983.06925","config_comm":"99bc8983.06925","addr":"00:13:a2:00:41:a3:d1:cd","sensor_type":"1","auto_config":true,"node_id":0,"delay":"300","destination":"0000FFFF","power":4,"retries":10,"pan_id":"7FFF","change_enabled":"","change_pr":"0","change_interval":"0","cm_calibration":"60.6","bp_altitude":"0","bp_pressure":"0","bp_temp_prec":"0","bp_press_prec":"0","amgt_accel":"0","amgt_mag":"0","amgt_gyro":"0","impact_accel":"0","impact_data_rate":"4","impact_threshold":25,"impact_duration":1,"activ_interr_x":1,"activ_interr_y":2,"activ_interr_z":4,"activ_interr_op":8,"filtering":0,"data_rate":5,"time_series":0,"reading_type":1,"x":300,"y":300,"wires":[["df6ab3eb.c0147","93e2f5e.0e0a108","6b76aa4d.37758c","86b55769.fca548","febbac70.a19a2"]]},{"id":"86b55769.fca548","type":"MSSQL","z":"a41e8b1b.0dadc","mssqlCN":"48d548c2.d378f","name":"MSSQL","query":"INSERT INTO [temperaturehumidity] (temp,humidity,nodeID,voltage,SensorName) VALUES ({{{payload.temperature}}}*1.8+32,{{{payload.humidity}}},{{{data.nodeId}}},{{{data.battery}}},'again a test')","outField":"payload","returnType":"0","throwErrors":"0","x":840,"y":300,"wires":[[]]},{"id":"99bc8983.06925","type":"ncd-gateway-config","z":"","name":"Wireless Modem","comm_type":"tcp","ip_address":"sanitized","tcp_port":"sanitized","port":"","baudRate":"115200","pan_id":"7FFF","rssi":false},{"id":"48d548c2.d378f","type":"MSSQL-CN","z":"","tdsVersion":"7_4","name":"sanitized","server":"sanitized","port":"1433","encyption":false,"database":"EnvironmentMonitoring","useUTC":true,"connectTimeout":"15000","requestTimeout":"15000","cancelTimeout":"5000","pool":"5"}]
Output area
Sql data types