SQL Server DATALENGTH Function

Example

Return the length of an expression (in bytes):

SELECT DATALENGTH('W3Schools.com');

Definition and Usage

The DATALENGTH() function returns the number of bytes used to represent an expression.

Note: The DATALENGTH() function counts both leading and trailing spaces when calculating the length of the expression.

 

Syntax

DATALENGTH(expression)

Continue reading SQL Server DATALENGTH Function