len

Description

Returns the number of characters, not the number of bytes, of a specified string expression, excluding trailing blanks.

Syntax

len(string_expression)

Parameters

string_expression

is the string expression to be evaluated.

Examples

Example 1

Returns the characters

select len(notes) from titles
where title_id = "PC9999"
-----------
39

Usage

This function is the equivalent of char_length(string_expression).

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

Any user can execute len.

See also

Datatypes char, nchar, varchar, or nvarchar

Functions char_length, left, str_replace