TO_STRING
Description
TO_STRING converts INT or DATE input to STRING output. For DATE input, you must specify the output format.
Output column type: STRING.
Syntax
TO_STRING ( table.column [, FORMAT ( format ) ] )
FORMAT syntax
The <format> defines how the input DATE should be converted.
The following special fields in <format> are supported:
%Y: 4-digit year.%m: 2-digit month of year.%d: 2-digit day of month.%H: 2-digit hour of day in 24-hour format.%M: 2-digit minutes per hour.%S: 2-digit seconds per minute.%%: A literal "%" character.
Any other FORMAT content is copied to the output STRING.
Null handling
If the input value is NULL, the output value is NULL as well.
Examples
[1] Convert integers to strings. NULL input is also NULL in the output: | ||||||||||||||||||
| ||||||||||||||||||
|
[2] Example in which a DATE constant is converted to a STRING type. Leading zero is added. | ||||||
| ||||||
|
[3] Example in which DATE values are converted to STRING types. NULL values are mapped to NULL values. | ||||||||||||||||
| ||||||||||||||||
|