Export (0) Print
Expand All
Expand Minimize

STR (SQL Server Compact Edition)

Returns character data converted from numeric data.


STR ( float_expression [ , length [ , decimal ] ] ) 

float_expression

An expression of that can be implicitly converted to float.

Note:
Do not use a function or subquery as the float_expression.

length

The total length, including decimal point, sign, digits, and spaces. The default is 10. The length argument must be of a data type that can be implicitly converted to int.

decimal

The number of places to the right of the decimal point. The decimal argument must be of a data type that can be implicitly converted to int. The default is 0.

nvarchar

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 t1 (Col1 float, Col2 float, Col3 float)
INSERT INTO t1 Values(123.45, 123.45, 123.45)
SELECT STR(Col1, 6,1), STR(Col2, 6,2), STR(Col3)
FROM t1
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft