LENGTH function [String]

Function

Returns the number of characters in the specified string.

Syntax

LENGTH ( string-expression )

Parameters

string-expression The string.

Example

The following statement returns the value 9.

SELECT LENGTH( 'chocolate' ) FROM iq_dummy

Usage

If the string contains multibyte characters, and the proper collation is being used, LENGTH returns the number of characters, not the number of bytes. If the string is of BINARY data type, the LENGTH function behaves as BYTE_LENGTH.

The LENGTH function is the same as the CHAR_LENGTH function.

Standards and compatibility

See also

“CHAR_LENGTH function [String]”

“BYTE_LENGTH function [String]”

Chapter 11, “International Languages and Character Sets” in the Sybase IQ System Administration Guide