DATALENGTH (Transact-SQL)
SQL Server 2005
Returns the number of bytes used to represent any expression.
Transact-SQL Syntax Conventions
- expression
-
Is an expression of any data type.
DATALENGTH is especially useful with varchar, varbinary, text, image, nvarchar, and ntext data types because these data types can store variable-length data.
The DATALENGTH of NULL is NULL.
Note: |
|---|
| Compatibility levels can affect return values. For more information about compatibility levels, see sp_dbcmptlevel (Transact-SQL) |