CAST (Azure Stream Analytics)

Converts an expression of one data type to another within the supported data types in Stream Analytics Query Language.

If the conversion cannot be performed, the function fails and causes the job to stop. For example, the clause CAST ('this is a string' AS bigint) results in a job failure since the input string cannot be converted into the bigint data type. To avoid type cast failures, use TRY_CAST function instead.

Note

To compare the different options available for type conversion, see casting data

Syntax

CAST ( expression AS data_type)

Arguments

expression

Is any valid expression.

data_type

Is the target data type supported by Stream Analytics Query Language.

Return Types

Returns expression translated to data_type.

Remark

See the data types article for more information about special cases.

Examples


SELECT TollId, EntryTime, LicensePlate, State, Make
FROM Input TIMESTAMP BY EntryTime
WHERE CAST( TollId AS bigint) > 2

See also

For more information on Stream Analytics data types, see: