【问题标题】:How to check null values in JSON property in stream analytics?如何在流分析中检查 JSON 属性中的空值?
【发布时间】:2019-03-01 09:28:39
【问题描述】:

我正在将以下 Json 输入从 Eventhub 传递到流分析。

{"meter_totalcycleenergy":null,"Test2": 20}, {"meter_totalcycleenergy":40,"Test2":20}

但作业未能说明错误。

尝试写入 1 个事件时遇到错误:无法从“System.String”类型的属性“meter_totalcycleenergy”转换为“System.Single”类型的“meter_totalcycleenergy”列。

Error Image 如何处理这种情况。

我认为 Json 空值不完全是 SQL 空值,那么在查询中检查空值的正确方法是什么?

meter_totalcycleenergy 的数据类型在我的数据库中是浮动的。

【问题讨论】:

  • 添加 IS NOT NULL 将起作用

标签: azure-stream-analytics stream-analytics


【解决方案1】:

您可以使用is not null。例如:

select *
from input
where meter_totalcycleenergy is not null

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-28
    • 1970-01-01
    • 1970-01-01
    • 2020-12-14
    • 1970-01-01
    相关资源
    最近更新 更多