T-SQL 101: 47 Determining the length of strings in SQL Server
You might need to work out how long a string is. There are two ways you could measure the length of a string. The first is the number of characters; the second is the number of bytes (i.e. the amount of data).
You can see both here:


Even though I’ve provided a Chinese string, LEN still returns 2 as the number of characters in the string.
But because they were each two-byte characters, the function DATALENGTH returns 4 as the total number of bytes.
2019-12-09




