Skip to main content

UINT8

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

Syntax

UINT8 ( 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 UINT8 representation of the value provided.

Remarks

  • If the value falls outside of the UINT8 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 UINT8 representation of the UINT64 1. Without data type context, numeric values are interpreted as their largest datatype. In this example, because 1 is unsigned it's interpreted as a UINT64.

SELECT UINT8(1);

Response:

UINT8(1) [UINT8]
1

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

SELECT UINT8(255);

Response:

The provided value overflows UINT8