Example
Returns character data (varchar
) converted from numeric data.
Parameters:
- float expression. An approximate numeric data type with a decimal point.
- length. optional. The total length of the string expression that would return, including digits, decimal point and leading spaces (if needed). The default value is 10.
- decimal. optional. The number of digits to the right of the decimal point. If higher then 16, the result would be truncated to sixteen places to the right of the decimal point.
SELECT STR(1.2) -- Returns ' 1'
SELECT STR(1.2, 3) -- Returns ' 1'
SELECT STR(1.2, 3, 2) -- Returns '1.2'
SELECT STR(1.2, 5, 2) -- Returns ' 1.20'
SELECT STR(1.2, 5, 5) -- Returns '1.200'
SELECT STR(1, 5, 2) -- Returns ' 1.00'
SELECT STR(1) -- Returns ' 1'