STR: takes a numeric value and changes the data type to a char : STR « String Functions « SQL Server / T-SQL






STR: takes a numeric value and changes the data type to a char

1> -- STR: takes a numeric value and changes the data type to a char.
2>
3> --STR(number_to_convert, length_of_string, [number_of_decimal_places])
4>
5> SELECT STR(100.325,7,2)
6> GO

-------
 100.33

(1 rows affected)
1>

           
       








Related examples in the same category

1.STR(100.325,7)
2.STR() function right-fills the decimal value with zeros
3.Specifying an overall length greater than the length of the value, decimal point, and the decimal value, the result will be left-padded with spaces
4.STR() Function: converts a numeric value to a string
5.STR(123.456789, 8, 4)