In this post we will go through two scalar functions
Len() is one of the string functions
Datalength is one of the Data type functions
so what does Len() do , it returns(int) the number of characters of the specified string expression, excluding trailing blanks.
excluding trailing blanks is an important note to remember when using Len() function
— It can also be used in select, where clause
set @string =‘sqljunkieshare’
select * from dept
where LEN(dept_id)> 5
Datalength() is data type function (size of the data)
It returns the number of bytes used to represent any expression.
Now you have a clear idea of what does LEN() and DATALENTH() scalar functions do