Returns the number of bytes used to represent any expression.

DATALENGTH ( expression ) 

Arguments

  • expression
    Is an expression of any data type.

int

Example

The following example returns the DATALENGTH of each company name listed in the Customers table in the Northwind database.

SELECT DATALENGTH([Company Name]) AS Expr1, [Company Name]
FROM Customers