Export (0) Print
Expand All

LEN

SQL Server 2000

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

Syntax
LEN ( string_expression ) 
Arguments
string_expression
Is the string expression to be evaluated. string_expression 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 Types

int

Example

The following example returns the company names listed in the Customers table in the Northwind database along with the number of characters in the company name.

SELECT CompanyName, LEN(CompanyName)
FROM Customers

Show:
© 2014 Microsoft