Numeric Styles Supported by CONVERT() in SQL Server

Below is a list of numeric styles supported by the CONVERT() function in SQL Server. These are the styles that can be used as the third argument to indicate how the input value is formatted.

float and real styles

When the expression is a float or real type, the style argument can be any of the values in the following table. Other values are processed as 0.

ValueOutput
0 (default)A maximum of 6 digits. Use in scientific notation, when appropriate.
1Always 8 digits. Always use in scientific notation.
2Always 16 digits. Always use in scientific notation.
3Always 17 digits. Use for lossless conversion. With this style, every distinct float or real value is guaranteed to convert to a distinct character string.

Applies to: SQL Server 2016 (13.x) and later versions, and Azure SQL Database.
126, 128, 129Included for legacy reasons. Don’t use these values for new development.

Source: Microsoft

money and smallmoney styles

When the expression is a money or smallmoney type, the style argument can be any of the values in the following table. Other values are processed as 0.

ValueOutput
0 (default)No commas every three digits to the left of the decimal point, and two digits to the right of the decimal point.

Example: 1234.56
1Commas every three digits to the left of the decimal point, and two digits to the right of the decimal point.

Example: 1,234.56
2No commas every three digits to the left of the decimal point, and four digits to the right of the decimal point.

Example: 1234.5678
126Equivalent to style 2, when converting to char(n) or varchar(n).

Source: Microsoft

Example of Usage

Here’s a quick example of how to use the above styles:

SELECT CONVERT( money, '1,234.56', 1 );

Result:

1234.56

We can use the sys.dm_exec_describe_first_result_set function to check the data type of the return value:

SELECT system_type_name
FROM sys.dm_exec_describe_first_result_set(
    'SELECT CONVERT( money, ''1,234.56'', 1 );', 
    null, 
    0);

Result:

money