Loading lesson path
Concept visual
Start at both ends
Return the length of an expression (in bytes):
DATALENGTH('W3Schools.com');The DATALENGTH() function returns the number of bytes used to represent an expression.
The DATALENGTH() function counts both leading and trailing spaces when calculating the length of the expression.
Also see the LEN() function.
expression )
Required. The data type to return the length for. If expression is NULL, it returns NULLSQL Server (starting with 2008), Azure SQL Database, Azure SQL Data Warehouse, Parallel Data Warehouse
Return the length of an expression (in bytes) (counts both leading and trailing spaces):
DATALENGTH(' W3Schools.com ');Return the length of an expression (in bytes):
DATALENGTH('2017-08');❮ SQL Server Functions