Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » SQL Anywhere Server - SQL Reference » SQL Functions » Alphabetical list of functions

CUME_DIST function [Ranking] Next Page

DATALENGTH function [System]


Returns the length, in bytes, of the underlying storage for the result of an expression.

Syntax

DATALENGTH( expression )

Parameters

expression    expression is usually a column name. If expression is a string constant, you must enclose it in quotes.

Remarks

The return values of the DATALENGTH function are as follows:

Data type

DATALENGTH

SMALLINT

2

INTEGER

4

DOUBLE

8

CHAR

Length of the data

BINARY

Length of the data

This function supports NCHAR inputs and/or outputs.

Standards and compatibility
Example

The following statement returns the value 27, the longest string in the CompanyName column.

SELECT MAX( DATALENGTH( CompanyName ) )
FROM Customers;

The following statement returns the value 22, the length of the string '8sdofinsv8s7a7s7gehe4h':

SELECT DATALENGTH( '8sdofinsv8s7a7s7gehe4h' );