CHARACTER_LENGTH

Click to skip syntax diagram
Read syntax diagramSkip visual syntax diagram>>-+-CHARACTER_LENGTH-+--(--expression--)----------------------><
   '-CHAR_LENGTH------'
 

The CHARACTER_LENGTH or CHAR_LENGTH function returns the length of a string expression. See LENGTH for a similar function.

expression
The argument must be an expression that returns a value of any built-in numeric or string data type. A numeric argument is cast to a character string before evaluating the function. For more information on converting numeric to a character string, see VARCHAR.

If the argument is a UTF-8 or UTF-16 string, the query cannot contain:

The result of the function is a large integer. If the argument can be null, the result can be null; if the argument is null, the result is the null value.

If expression is a character string or graphic string, the result is the number of characters in the argument (not the number of bytes). A single character is either an SBCS, DBCS, or multiple-byte character. If expression is a binary string, the result is the number of bytes in the argument. The length of strings includes trailing blanks or hexadecimal zeroes. The length of a varying-length string is the actual length, not the maximum length.

Example