Tuesday, July 22, 2014

Difference Between LEN and DATALENGTH

DATALENGTH - Returns the number of bytes used to represent any expression.

LEN - Returns the number of characters of the specified string expression, excluding trailing blanks

image

Output is 30, 3.

Important point to remember is is LEN function does not depend on the data type and it is storage mechanism. LEN function total depends on the number of string characters.

image

Output is 8 and 3.

So DATALENGTH is depends on the storage but not the LEN function.

No comments:

Post a Comment