环境:ROCKY 8.1 EMQX6.2 企业版 SQLSERVER2022
数据库表建表语句:
CREATE TABLE [dbo].[DeviceStatus_Current](
[id] [int] IDENTITY(1,1) NOT NULL,
[create_time] datetime2 NOT NULL,
[type] [int] NULL,
[Device_No] varchar NULL,
[Status] [int] NULL,
[Fault] [int] NULL,
[Fault_Type] [int] NULL,
CONSTRAINT [PK_DeviceStatus_Current] PRIMARY KEY CLUSTERED
(
[create_time] ASC,
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF, DATA_COMPRESSION = PAGE) ON ps_SCADA_monthly
) ON ps_SCADA_monthly
GO
动作sql
UPDATE DeviceStatus_Current SET Fault = ‘0’
运行测试时报错:
{
“time”: “2026-06-26T13:41:29.435780+08:00”,
“msg”: “action_failed”,
“meta”: {
“trace_tag”: “ACTION”,
“rule_trigger_ts”: [
1782452489372
],
“rule_id”: “rule_020101_DL01_Status”,
“reason”: “failed_to_apply_sql_template”,
“namespace”: “global”,
“clientid”: “020101_DL01”,
“action_info”: {
“type”: “sqlserver”,
“name”: “DL01_Status_Current”
}
},
“level”: “debug”
}
后台报错:
{“time”:1782452849429363,“level”:“error”,“msg”:“sqlserver_connector_do_query_failed”,“rule_trigger_ts”:[1782452849367],“rule_ids”:{“rule_020101_DL01_Status”:true},“client_ids”:{“020101_DL01”:true},“payload_encode”:“text”,“namespace”:“global”,“connector”:“connector:sqlserver:JR-SCADA-DB-01”,“query”:“Encoded(text)={<<"action:sqlserver:DL01_Status_Current:connector:sqlserver:JR-SCADA-DB-01">>,#{<<"DEVICE_Fault">> => <<>>,<<"DEVICE_Status">> => 2,<<"Fault_Type">> => <<>>,<<"time_ms">> => <<"1782452850">>,<<"type">> => 0}}”,“reason”:“{unrecoverable_error,failed_to_apply_sql_template}”,“pid”:“<0.468501.0>”,“line”:510}
{“time”:1782452849429841,“level”:“error”,“msg”:“unrecoverable_resource_error”,“resource_id”:“action:sqlserver:DL01_Status_Current:connector:sqlserver:JR-SCADA-DB-01”,“namespace”:“global”,“tag”:“RESOURCE”,“reason”:“{unrecoverable_error,failed_to_apply_sql_template}”,“pid”:“<0.468501.0>”}
执行insert into可以正常运行,update就报错。
请问如何排查?谢谢


