AS_CHAR

functionsupportedCore SQL functions

docs.snowflake.com ↗

Semi-structured and structured data functions

Casts a VARIANT value to a VARCHAR value. This function only converts CHAR and VARCHAR values. The AS_CHAR and AS_VARCHAR functions are synonymous. The CHAR data type is synonymous with the VARCHAR data type, except for its default length.

Syntax

AS_CHAR( <variant_expr> )

AS_VARCHAR( <variant_expr> )

Parameters

NameRequiredDescription
variant_exprrequiredAn expression that evaluates to a value of type VARIANT.

Returns

The function returns a value of type VARCHAR or NULL: - If the type of the value in the variant_expr argument is CHAR or VARCHAR, the function returns a value of type VARCHAR. - If the type of the value in the variant_expr argument doesn’t match the type of the output value, the function returns NULL. - If the variant_expr argument is NULL, the function returns NULL.

See also