Chapter 8 SQL Functions
325
SELECT city , Count(*)
FROM employee
GROUP BY city
♦ SQL/92 SQL/92 compatible.
♦
Sybase Compatible with Adaptive Server Enterprise.
"AVG function " on page 316
"SUM function" on page 370
DATALENGTH function [System]
Returns the length in bytes of the underlying storage for the result of an
expression.
DATALENGTH (
expression
)
expression The expression is usually a column name. If the expression is
a string constant, it must be enclosed in quotes.
The return values of DATALENGTH are as follows:
Data type DATALENGTH
SMALLINT 2
INTEGER 4
DOUBLE 8
CHAR Length of the data
BINARY Length of the data
The following statement returns the value 27, the longest string in the
company_name
column.
SELECT following MAX( DATALENGTH( company_name ) )
FROM customer
♦ SQL/92 Vendor extension.
♦
Sybase Compatible with Adaptive Server Enterprise.
DATE function [Date and time]
Converts the expression into a date, and removes any hours, minutes or
seconds.
DATE (
expression
)
Standards and
compatibility
See also
Function
Syntax
Parameters
Usage
Examples
Standards and
compatibility
Function
Syntax