difference between datalength() and len()

can i know what is difference between datalength() and len() functions in ms sql.
pavanarkAsked:
Who is Participating?
 
momi_sabagCommented:
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
 
HuyBDCommented:
datalength() returns the length of the string in bytes without trimming.
len() returns the length in characters with trimming
0
 
Éric MoreauSenior .Net ConsultantCommented:
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.