我想使用包含 CROSS APPLY GetArrayElements() 的流分析查询将此数组转换为行,但此函数需要数组名称。显然没有名字。有什么建议么?
要解析的 JSON 示例:
{
"Alert1": {
"Site": "11109370",
"Sensor": "UPS",
"Event": "Load Not Protected",
"Time": "08-28-2019 10:39:02",
"Value": "0",
"Threshold": 0,
"Severity": "2",
"Status": "Open"
},
"Alert2": {
"Site": "11109370",
"Sensor": "UPS",
"Event": "Emergency stop",
"Time": "08-28-2019 10:39:02",
"Value": "1",
"Threshold": 1,
"Severity": "2",
"Status": "Open"
},
"Alert3": {
"Site": "11109370",
"Sensor": "UPS",
"Event": "Load Protected(UPS Coupled)",
"Time": "08-28-2019 10:39:02",
"Value": "0",
"Threshold": 0,
"Severity": "1",
"Status": "Open"
},
"Alert4": {
"Site": "11109370",
"Sensor": "UPS",
"Event": "Battery Deep Discharge Protection",
"Time": "08-28-2019 10:39:02",
"Value": "0",
"Threshold": 0,
"Severity": "1",
"Status": "Open"
},
"Alert5": {
"Site": "11109370",
"Sensor": "UPS",
"Event": "Battery Present",
"Time": "08-28-2019 10:39:02",
"Value": "0",
"Threshold": 0,
"Severity": "1",
"Status": "Open"
},
"Alert6": {
"Site": "11109370",
"Sensor": "UPS",
"Event": "Sensor Communication Error",
"Time": "08-28-2019 10:39:02",
"Status": "Close"
}
}
我尝试了下面的代码,但遇到了错误:
错误:列名无效:'arrayvalue'。具有该名称的列不存在。
SELECT message.ArrayValue
FROM INPUT as event
CROSS APPLY GetRecordProperties(event) AS message