Returns the length, in bytes, of the underlying storage for the result of an expression.
DATALENGTH( expression )
expression Usually a column name. If expression is a string constant, you must enclose it in quotes.
The return values of the DATALENGTH function are as follows:
| Data type | DATALENGTH |
|---|---|
| SMALLINT | 2 |
| INTEGER | 4 |
| DOUBLE | 8 |
| CHAR | Length of the data |
| BINARY | Length of the data |
This function supports NCHAR inputs and outputs.
SQL/2003 Vendor extension.
The following statement returns the value 27, the longest string in the CompanyName column.
SELECT MAX( DATALENGTH( CompanyName ) ) FROM Customers; |
The following statement returns the value 22, the length of the string '8sdofinsv8s7a7s7gehe4h':
SELECT DATALENGTH( '8sdofinsv8s7a7s7gehe4h' ); |
| Send feedback about this page via email or DocCommentXchange | Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0 |