FORMAT Function

Description

The FORMAT function displays the number x by using commas as thousands delimiters, so that its format becomes ‘#,###,###.#####’ and performs rounding after the decimal point to express as many as dec digits after it. The return value is a string type.

Syntax

FORMAT ( x , dec )

Example

SELECT FORMAT(12000.123456,3), FORMAT(12000.123456,0);

  format(12000.123456, 3)   format(12000.123456, 0)

============================================

  '12,000.123'          '12,000'