Skip to main content

UINT16

This function is used to cast data to the UINT16 data type.

Syntax

UINT16 ( arg )  

arg
The value to be cast. The value has to be of a Numeric or Date & Time data type category.

Return Value

Returns the UINT16 representation of the value provided.

Remarks

  • If the value falls outside of the UINT16 range, an overflow error is returned.
  • Date & Time values are first converted to their underlying unix representation before being converted.
  • Conversions from floating point numbers floor the value.

Examples

This returns the UINT16 representation of the FLOAT64 33.3. Without data type context, numeric values are interpreted as their largest datatype. In this example, because 33.3 is a floating point number it's interpreted as a FLOAT64.

SELECT UINT16(33.3);

Response:

UINT16(33.3) [UINT16]
33

If we operate on a values that exceeds the range of UINT16 the query errors.

SELECT UINT16(-1);

Response:

The provided value overflows UINT8