difference between datalength() and len()

can i know what is difference between datalength() and len() functions in ms sql.
pavanarkAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
momi_sabagConnect With a Mentor Commented:
datalength returns number of bytes used by any expression
len returns number of characters in string expression
which means that for strings, if the string is unicode you might get a different result since each character can be represented using 2 bytes
for numeric expressions you can only use datalength
0
 
HuyBDConnect With a Mentor Commented:
datalength() returns the length of the string in bytes without trimming.
len() returns the length in characters with trimming
0
All Courses

From novice to tech pro — start learning today.