Convert a number into its string representation.
| SELECT STR(185); |
The STR() function converts a number into a string format.
| STR(number, length, decimals) |
|
Parameter |
Description |
|
Number |
Required: Specifies the number that needs to be converted into a string format. |
|
Length |
Optional: Specifies the length of the resulting string. If not provided, the default value is 10. |
|
decimal |
Optional: Specifies the number of decimal places to display in the resulting string. If not provided, the default value is 0. |
|
Works in: |
SQL Server (from 2008 onward), Azure SQL Database, Azure SQL Data Warehouse, and Parallel Data Warehouse |
Convert a numeric value into its string representation.
| SELECT STR(185.5); |
Convert a numerical value into a string format.
| SELECT STR(185.476, 6, 2); |