SQL References by Patrik

DATALENGTH (Transact-SQL)

This function returns the number of bytes used to represent any expression.

To return the number of characters in a string expression, use the LEN function.

This example finds the length of the Name column in the Product table:

SELECT length = DATALENGTH(EnglishProductName), EnglishProductName
FROM dbo.DimProduct
ORDER BY EnglishProductName;

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

Comments