Using DATALENGTH to determine length of a string value. : DATALENGTH « System Functions « SQL Server / T-SQL Tutorial






6>     SELECT UPPER(SUBSTRING("this Is a tEst.",1,1)) +
7>            LOWER(SUBSTRING("this Is a tEst.",2,
8>               (DATALENGTH("this Is a tEst.")-1)))
9>
10> GO

---------------
This is a test.

(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.