SQL Server 2008 R2
Returns character data converted from numeric data.
The following example converts expressions consisting of five digits and a decimal point to six-position character strings. The fractional part of the first number is rounded to one decimal place. The fractional part of the second number is rounded to two decimal places. The third number is returned without a decimal place.
CREATE TABLE ExampleTable (Col1 float, Col2 float, Col3 float); INSERT INTO ExampleTable Values(123.45, 123.45, 123.45); SELECT STR(Col1, 6,1), STR(Col2, 6,2), STR(Col3) FROM ExampleTable;
Show: