The DATALENGTH() function returns the number of bytes used to manage a value. : DATALENGTH « System Functions « SQL Server / T-SQL Tutorial






3>
4> DECLARE @Value VarChar(20)
5> SET @Value = 'abc'
6> SELECT DATALENGTH(@Value)
7> SELECT LEN(@Value)
8> GO

-----------
          3

(1 rows affected)

-----------
          3

(1 rows affected)








25.7.DATALENGTH
25.7.1.Using DATALENGTH to determine length of a string value.
25.7.2.The DATALENGTH() function returns the number of bytes used to manage a value.
25.7.3.SELECT DATALENGTH(@Value2)
25.7.4.DATALENGTH Versus COL_LENGTH to determine length of a string value.