Chapter 8 SQL Functions
367
♦
SQL/92 Vendor extension.
♦
Sybase Compatible with Adaptive Server Enterprise.
SQRT function [Miscellaneous]
Returns the square root of a number.
SQRT (
numeric-expression
)
numeric-expression The number for which the square root is to be
calculated.
The following statement returns the value
3.
SELECT SQRT( 9 )
♦ SQL/92 Vendor extension.
♦
Sybase Compatible with Adaptive Server Enterprise.
STR function [String]
Returns the string equivalent of a number.
STR (
numeric_expression
[,
length
[,
decimal
] ] )
numeric-expression Any approximate numeric (float, real, or double
precision) expression.
length 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 The number of decimal digits to be returned. The default is 0.
The following statement returns a string of six spaces followed by 1235, for
a total of ten characters:
SELECT STR( 1234.56 )
The following statement returns the result 1234.6:
SELECT STR( 1234.56, 6, 1 )
If the integer portion of the number cannot fit in the length specified, then the
result is a string of the specified length containing all asterisks. For example,
the following statement returns ***
SELECT STR( 1234.56, 3 )
Standards and
compatibility
Function
Syntax
Parameters
Examples
Standards and
compatibility
Function
Syntax
Parameters
Examples
Usage