BYTE_LENGTH Function [String]

Returns the number of bytes in a string.

Syntax

BYTE_LENGTHstring-expression )

Parameters

Parameters

Parameters

Description

string-expression

The string whose length is to be calculated.

Returns

INT

Example

Returns the value 12:

SELECT BYTE_LENGTH( 'Test Message' ) FROM iq_dummy

Usage

Trailing white space characters are included in the length returned.

The return value of a NULL string is NULL.

If the string is in a multibyte character set, the BYTE_LENGTH value differs from the number of characters returned by CHAR_LENGTH.

If you are licensed to use the Unstructured Data Analytics functionality, you can use this function with large object data.

See Unstructured Data Analytics in Sybase IQ > Function Support.

Standards and Compatibility

  • SQL—Vendor extension to ISO/ANSI SQL grammar.

  • Sybase—Not supported by Adaptive Server Enterprise.

Related reference
BIT_LENGTH Function [String]
CHAR_LENGTH Function [String]
COL_LENGTH Function [System]
DATALENGTH Function [System]
LEN Function [String]
LENGTH Function [String]
OBJECT_NAME Function [System]
OCTET_LENGTH Function [String]
STR_REPLACE Function [String]