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

LEFT function [String] Next Page

LENGTH function [String]


Returns the number of characters in the specified string.

Syntax

LENGTH( string-expression )

Parameters

string-expression    The string.

Remarks

Use this function to determine the length of a string. For example, specify a column name for string-expression to determine the length of values in the column.

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 data type BINARY, the LENGTH function behaves as the BYTE_LENGTH function.

Note

You can use the LENGTH function and the CHAR_LENGTH function interchangeably for CHAR, VARCHAR, LONG VARCHAR, and NCHAR data types. However, you must use the LENGTH function for BINARY and bit array data types.

This function supports NCHAR inputs and/or outputs.

See also
Standards and compatibility
Example

The following statement returns the value 9.

SELECT LENGTH( 'chocolate' );