str

Description

Returns the character equivalent of the specified number.

Syntax

str(approx_numeric[, length [, decimal]])

Parameters

approx_numeric

is any approximate numeric (float, real, or double precision) column name, variable, or constant expression.

length

sets the number of characters to be returned (including the decimal point, all digits to the right and left of the decimal point, and blanks). The default is 10.

decimal

sets the number of decimal digits to be returned. The default is 0.

Examples

Example 1

select str(1234.7, 4)
----
1235

Example 2

select str(-12345, 6)
------
-12345

Example 3

select str(123.45, 5, 2)
-----
123.5

Usage

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

Any user can execute str.

See also

Functions abs, ceiling, floor, round, sign