LEN

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

Syntax

LEN ( string_expression )

Arguments

string_expression

Is the string expression to be evaluated. string_expression can be a constant, variable, or column of either character or binary data.

Return types

bigint if expressionToSearch is of the varchar(max), nvarchar(max), or varbinary(max) data types; otherwise an int.

Example

SELECT LEN('abcdefg');

See Also