DATALENGTH (Binary String) (TSQL Function)

Returns the length of a binary string, in bytes.

Syntax

DATALENGTH ( binary_string_expression )

Arguments

binary_string_expression
is a binary string expression of type varbinary.

Return Types

Returns int.

Remarks

This function is exactly the same as LEN.

Examples

PRINT DATALENGTH(0x);
PRINT DATALENGTH(0x11223344556677889900);

The result is:

0
10