EasyManua.ls Logo

Sybase Adaptive Server Anywhere - Page 349

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
331
DAYS (
datetime-expression
)
| (
datetime-expression
,
datetime-expression
)
| (
datetime-expression
,
integer-expression
)
datetime-expression A date and time.
integer-expression The number of days to be added to the datetime-
expression. If the integer-expression is negative, the appropriate number of
days are subtracted from the datetime. If you supply an integer expression,
the datetime-expression must be explicitly cast as a date.
$ For information on casting data types, see "CAST function" on
page 318
DAYS ignores hours, minutes, and seconds.
The following statement returns the integer value 729889.
SELECT DAYS( ’1998-07-13 06:07:12’ )
The following statement returns the integer value -366, which is the
difference between the two dates.
SELECT DAYS( ’1998-07-13 06:07:12’,
’1997-07-12 10:07:12’ )
The following statement returns the timestamp value 1998-07-13:
SELECT DAYS( CAST(’1998-07-13’ AS DATE ), 366 )
SQL/92 Vendor extension.
Sybase Not supported by Adaptive Server Enterprise.
DB_ID function [System]
Returns the database ID number.
DB_ID ( [
database-name
] )
database-name A string containing the database name. If no database-
name is supplied, the ID number of the current database is returned.
The following statement returns the value 0 if
asademo
is the only running
database:
SELECT DB_ID( ’asademo’ )
The following statement returns the value 0 if executed against the only
running database.
SELECT DB_ID()
Syntax
Parameters
Examples
Standards and
compatibility
Function
Syntax
Parameters
Examples

Table of Contents

Related product manuals