to_base
Converts number to a string in the given base radix, optionally padding with leading zeros to min_length.
Try an expression
In Formula, enter the expression and set Output type to VARCHAR.
Expression
to_base(42, 16, 5)Result
'0002A'To use your own data, replace the example values with column names. Keep format strings and other options as written.
Arguments and types
to_base(number, radix, min_length)- number
- Number
- radix
- Number
- min_length
- Number
Supported signatures (2)
to_base(number: BIGINT, radix: INTEGER) → VARCHAR
to_base(number: BIGINT, radix: INTEGER, min_length: INTEGER) → VARCHARThe result type can depend on the input types. See DuckDB for the full argument rules.
Things to know
If the first argument is missing, the result is NULL.
Function metadata from DuckDB, used under the MIT license.