EasyManua.ls Logo

Sybase Adaptive Server Anywhere - Page 335

Sybase Adaptive Server Anywhere
1182 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 8 SQL Functions
317
Trailing white space characters are included in the length returned.
The return value of a NULL string is NULL.
If the string is in a multi-byte character set, the BYTE_LENGTH value
differs from the number of characters returned by CHAR_LENGTH.
SQL/92 Vendor extension.
Sybase Not supported by Adaptive Server Enterprise.
"CHAR_LENGTH function" on page 320
"DATALENGTH function" on page 325
"LENGTH function" on page 344
BYTE_SUBSTR function [String]
Returns a substring of a string. The substring is calculated using bytes, not
characters.
BYTE_SUBSTR (
string-expression
,
start
[,
length
] )
string- expression The string from which the substring is taken.
start An integer expression indicating the start of the substring. A positive
integer starts from the beginning of the string, with the first character being
position 1. A negative integer specifies a substring starting from the end of
the string, the final character being at position -1.
length An integer expression indicating the length of the substring. A
positive length specifies the number of bytes to be taken starting at the start
position. A negative length specifies the number of bytes to be taken ending
at the start position.
The following statement returns the value age.
SELECT BYTE_SUBSTR( ’Test Message’,-1,-3 )
If length is specified, the substring is restricted to that number of bytes. Both
start and length can be either positive or negative. A negative starting
position specifies a number of bytes from the end of the string instead of the
beginning. A positive length specifies that the substring ends length bytes to
the right of the starting position, while a negative length specifies that the
substring ends length bytes to the left of the starting position and ends at the
start position. Using appropriate combinations of negative and positive
numbers, you can get a substring from either the beginning or end of the
string.
Usage
Standards and
compatibility
See also
Function
Syntax
Parameters
Examples
Usage

Table of Contents

Related product manuals