EasyManua.ls Logo

Sybase Adaptive Server Anywhere - Page 393

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
375
integer-expression The number of weeks to be added to the datetime-
expression. If integer-expression is negative, the appropriate number of
weeks are subtracted from the datetime value. If you supply an integer
expression, the datetime-expression must be explicitly cast as a datetime data
type.
$ For information on casting data types, see "CAST function" on
page 318.
The following statement returns the value 104270:
SELECT WEEKS( ’1998-07-13 06:07:12’ )
The following statement returns the value 8, to signify the difference
between the two dates:
SELECT WEEKS( ’1999-07-13 06:07:12’,
’1999-09-13 10:07:12’ )
The following statement returns the timestamp value 1999-06-16 21:05:07.
SELECT WEEKS( CAST( ’1999-05-12 21:05:07’
AS TIMESTAMP ), 5)
The value of WEEKS is calculated from the number of Sundays between the
two dates.
SQL/92 Vendor extension.
Sybase Not supported by Adaptive Server Enterprise.
YEARS function [Date and time]
Returns the number of years since an arbitrary date and time, between two
specified times, or adds the specified integer-expression amount of years to a
datetime.
YEARS (
datetime-expression
|
datetime-expression, datetime-expression
|
datetime-expression, integer-expression
)
datetime-expression A date and time.
integer-expression The number of years to be added to the datetime-
expression. If integer-expression is negative, the appropriate number of years
are subtracted from the datetime value. If you supply an integer expression,
the datetime-expression must be explicitly cast as a datetime data type.
$ For information on casting data types, see "CAST function" on
page 318.
The following statement returns the value 1998:
Examples
Usage
Standards and
compatibility
Function
Syntax
Parameters
Examples

Table of Contents

Related product manuals