SQL References by Patrik

LEN (Transact-SQL)

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

To return the number of bytes used to represent an expression, use the DATALENGTH function.

The following example selects the number of characters and the data in FirstName column

SELECT LEN(FirstName) AS Length, FirstName
FROM Sales.vIndividualCustomer  
WHERE CountryRegionName = 'Australia';

Source: LEN (Transact-SQL) - SQL Server | Microsoft Docs

SQL

Comments

Leave a Comment

All fields are required. Your email address will not be published.