简体   繁体   English

Azure流分析-将字符串转换为浮点的SQL

[英]Azure Stream Analytics - SQL to convert string to float

What is the easiest way to convert a string to a float in the Azure Stream Analytics job service query? 在Azure Stream Analytics作业服务查询中将字符串转换为浮点数的最简单方法是什么? Unfortunately, I'm quite new to SQL, but only need this conversion applied to the CSV data stream. 不幸的是,我对SQL还是很陌生,但只需要将此转换应用于CSV数据流。

This is what I get from the Test option on the query page... 这是我从查询页面上的“测试”选项中获得的...

'DeviceID','Temperature'
'20','30.8'
'20','32.1'
'20','31.5'
'20','28.2'
'20','29.1'

...when I use... ...当我使用...

SELECT *
INTO TempPowerBI
FROM Tempiothub

... but in Power BI, the numbers can't be displaced. ...但是在Power BI中,数字不能被取代。 Instead, the amount of data is counted. 相反,将计算数据量。 So I guess the Stream Analytics query is the best place to convert the data. 因此,我想Stream Analytics查询是转换数据的最佳位置。

Thanks a lot in advance ~ 在此先多谢〜

M. M.

You can utilize CAST() . 您可以利用CAST() Try This: 尝试这个:

SELECT DeviceID , CAST( Temperature AS float) as  Temperature
INTO TempPowerBI
FROM Tempiothub

https://msdn.microsoft.com/en-us/library/azure/dn834995.aspx https://msdn.microsoft.com/en-us/library/azure/dn834995.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM