简体   繁体   中英

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? Unfortunately, I'm quite new to SQL, but only need this conversion applied to the CSV data stream.

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. Instead, the amount of data is counted. So I guess the Stream Analytics query is the best place to convert the data.

Thanks a lot in advance ~

M.

You can utilize 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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