str

The str function converts numbers to characters, with optional arguments for specifying the length of the number (including sign, decimal point, and digits to the right and left of the decimal point), and the number of places after the decimal point.

Set length and decimal arguments to str positive. The default length is 10. The default decimal is 0. The length should be long enough to accommodate the decimal point and the number’s sign. The decimal portion of the result is rounded to fit within the specified length. If the integer portion of the number does not fit within the length, however, str returns a row of asterisks of the specified length.

For example:

select str(123.456, 2, 4) 
 
-- 
** 
 
(1 row affected)

A short approx_numeric is right-justified in the specified length, and a long approx_numeric is truncated to the specified number of decimal places.