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.
UNSIGNED INT
The return values of the DATALENGTH function are as follows:
Data type | DATALENGTH |
---|---|
BIT | 1 |
TINYINT | 1 |
SMALLINT | 2 |
INTEGER | 4 |
BIGINT | 8 |
REAL | 4 |
DOUBLE | 8 |
TIME | 8 |
DATE | 4 |
TIMESTAMP | 8 |
DATETIME | 8 |
TIMESTAMP WITH TIME ZONE | 29 |
UNIQUEIDENTIFIER | 16 |
CHAR | Length of the data |
VARCHAR | Length of the data |
BINARY | Length of the data |
VARBINARY | Length of the data |
NCHAR | Length of the data |
NVARCHAR | Length of the data |
TEXT | Length of the data |
NTEXT | Length of the data |
IMAGE | Length of the data |
XML | Length of the data |
The following statement returns the length of the longest string in the CompanyName column:
SELECT MAX( DATALENGTH( CompanyName ) ) FROM GROUPO.Customers; |
The following statement returns the length of the string '8sdofinsv8s7a7s7gehe4h':
SELECT DATALENGTH( '8sdofinsv8s7a7s7gehe4h' ); |
![]() |
Discuter à propos de cette page dans DocCommentXchange.
|
Copyright © 2013, SAP AG ou société affiliée SAP - SAP Sybase SQL Anywhere 16.0 |