format_number
function
Applies to: Databricks SQL Databricks Runtime
Formats expr
like #,###,###.##
, rounded to scale
decimal places.
Formats expr
like fmt
.
Syntax
format_number(expr, scale)
format_number(expr, fmt)
Arguments
expr
: An expression that evaluates to a numeric.scale
: An INTEGER expression greater or equal to 0.fmt
: A STRING expression specifying a format.
Returns
A STRING.
A negative scale
produces a null.
Examples
> SELECT format_number(12332.123456, 4);
12,332.1235
> SELECT format_number(12332.123456, '#.###');
12332.123
> SELECT format_number(12332.123456, 'EUR ,###.-');
EUR 12,332.-
Related functions
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for