LEN (SQL Server Compact)

Returns the number of characters, instead of the number of bytes, of the given string expression, excluding trailing blanks.

Syntax

LEN ( string_expression ) 

Arguments

  • string_expression
    The string expression to be evaluated. The string_expression argument can be any data type that can be implicitly converted to nvarchar. Binary expressions can also be supplied as arguments, in which case the number of bytes is returned.

Return Value

int

Example

The following example returns the company names listed in the Customers table and the number of characters in the company name.

SELECT [Company Name], LEN([Company Name]) AS Expr1
FROM Customers

Remarks

LEN function does not support the following data types.

  • money
  • ntext
  • image