Michelle Turner
Michelle Turner

Reputation: 324

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.

Upvotes: 0

Views: 1482

Answers (1)

Kashif Qureshi
Kashif Qureshi

Reputation: 1490

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

Upvotes: 1

Related Questions