Returns the length of the expression in bytes.
DATALENGTH ( expression )
expression The expression is usually a column name. If the expression is a string constant, it must be enclosed in quotes.
Table 5-14 lists the return values of DATALENGTH.
Data type |
DATALENGTH |
---|---|
SMALLINT |
2 |
INTEGER |
4 |
DOUBLE |
8 |
CHAR |
Length of the data |
BINARY |
Length of the data |
The following statement returns the value 35, the longest string in the company_name column:
SELECT MAX( DATALENGTH( company_name ) ) FROM customer