Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

In SQL Server, the FORMAT function can be used to format decimal places with commas. The syntax is as follows:

FORMAT (value, 'format')

The 'value' parameter is the decimal value you want to format with commas, and the 'format' parameter specifies the format in which you want to display the decimal value. For example, to format a decimal value with two decimal places and commas, you can use the following code:

SELECT FORMAT(1234567.89, 'N2')

This will return the value '1,234,567.89'.

Alternatively, you can use the CONVERT function to format decimal values with commas as follows:

SELECT CONVERT(varchar, CAST(1234567.89 AS money), 1)

This will also return the value '1,234,567.89'. The '1' parameter in the CONVERT function specifies the format style.