All Products
Search
Document Center

Conversion functions

Last Updated: Jan 15, 2019

If conversion requirements are met, Data Lake Analytics (DLA) implicitly converts numeric and character values to the correct type. However, DLA cannot convert between character and numeric types. For example, in the case where the expected query result is varchar, DLA does not automatically convert a bigint value to a varchar value.

Conversion functions

cast(value AS type) → type

Explicitly casts a value as a type. This function can cast a varchar to a numeric value type (and perform the converse operation).

try_cast(value AS type) → type

Similar to cast, but returns NULL when cast fails.

Miscellaneous

typeof(expr) → varchar

Returns the name of the type provided by the expression.

  1. SELECT typeof(123); -- integer
  2. SELECT typeof('cat'); -- varchar(3)
  3. SELECT typeof(cos(2) + 1.5); -- double