Chapter 8 SQL Functions
319
♦
SQL/92 Vendor extension.
♦
Sybase Compatible with Adaptive Server Enterprise.
"FLOOR function" on page 338
CHAR function [String]
Returns the character with the ASCII value of a number.
CHAR (
integer-expression
)
integer expression The number to be converted to an ASCII character.
The number must be in the range 0 to 255, inclusive.
The following statement returns the value Y.
SELECT CHAR( 89 )
The character returned corresponds to the supplied numeric expression in the
current database character set, according to a binary sort order.
CHAR returns NULL for integer expressions with values greater than 255 or
less than zero.
♦
SQL/92 Vendor extension.
♦
Sybase Compatible with Adaptive Server Enterprise.
CHARINDEX function [String]
Returns the position of one string in another.
CHARINDEX (
string-expression1, string-expression2
)
string expression1 The string you are searching for.
string expression2 The string to be searched.
The statement
SELECT emp_lname, emp_fname
FROM employee
WHERE CHARINDEX(’K’, emp_lname ) = 1
returns the following values:
Standards and
compatibility
See also
Function
Syntax
Parameters
Examples
Usage
Standards and
compatibility
Function
Syntax
Parameters
Examples