azure - SELECT 字符串表达式识别单引号而不是双引号?

标签 azure azure-stream-analytics

我正在创建一个 Azure 流分析查询,需要输出一个常量列标题/值,并且我注意到,如果我将字符串表达式包含为 SELECT 项,则它需要用单引号 (') 而不是双引号 (") 括起来,否则我会得到 NULL。

SELECT 'foo' as "bar" INTO ... FROM ... >>> outputs foo as a value of bar.
SELECT "foo" as "bar" INTO ... FROM ... >>> outputs null as a value of bar.

为什么字符串文字需要单引号?如果我使用双引号,那么将该文字解释为什么?

谢谢

-约翰

最佳答案

根据我的测试,单引号(')和双引号(")都可以得到结果。

我的测试json如下:

{"plantId": "Plant A", "machineId" : "M001", "sensorId": "S001", "unit": "kg", "time": "2017-09-05T22:00:14.9410000Z", "value": 1234.56}

{"plantId": "Plant A", "machineId" : "M001", "sensorId": "S001", "unit": "kg", "time": "2017-09-05T22:00:19.5410000Z", "value": 1334.76}

结果如下:

enter image description here

<小时/>

如果使用单引号来选择值,则结果将是单引号的值。查询不会将值作为列名来选择结果:

像这样:

enter image description here

但是如果使用双引号来选择值,查询会将其视为列名。所以你会得到空结果。因为查询无法选择数据。

enter image description here

关于azure - SELECT 字符串表达式识别单引号而不是双引号?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46258348/

相关文章:

azure - 有没有办法为 Azure 应用服务设置磁盘空间不足警报

azure - 如何使用带有分区键的 CosmosDb 作为流分析输出?

azure - 在 Azure Analytics 作业中设置日期时间格式

azure - 在流分析查询中将字符串转换为日期时间

azure - 在 Azure Service Fabric 应用程序中存储配置值的位置

.net - 使用什么云 API - simplecloud?

Azure 流分析 : Making the TUMBLINGWINDOW function start date of each window inclusive and end date of each window exclusive

visual-studio - 适用于 Visual Studio 的 Azure 流分析工具 : Error when executing aggregated queries - "Object reference not set to an instance of an object"

azure - 将许可证分配给 guest 用户

azure - 在 Windows 命令提示符下从批处理文件运行 AzCopy 复制失败