Chapter 8 SQL Functions
351
datetime-expression A date and time.
integer-expression The number of months to be added to the datetime-
expression. If integer-expression is negative, the appropriate number of
months 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 23982:
SELECT MONTHS( ’1998-07-13 06:07:12’ )
The following statement returns the value 2, to signify the difference
between the two dates:
SELECT MONTHS( ’1999-07-13 06:07:12’,
’1999-09-13 10:07:12’ )
The following statement returns the datetime value 1999-10-12 21:05:07.
SELECT MONTHS( CAST( ’1999-05-12 21:05:07’
AS DATETIME ), 5)
The value of MONTHS is calculated from the number of first days of the
month between the two dates.
♦
SQL/92 Vendor extension.
♦
Sybase Not supported by Adaptive Server Enterprise.
NEXT_CONNECTION function [System]
Returns an identifying number for a connection.
NEXT_CONNECTION ( [
connection-id
] [,
database-id
] )
connection-id An integer, usually returned from a previous call to
NEXT_CONNECTION. If connection-id is NULL, NEXT_CONNECTION
returns the first connection ID.
database-id An integer representing one of the databases on the current
server. If you supply no database-id, the current database is used. If you
supply NULL, then NEXT_CONNECTION returns the next connection
regardless of database.
The following statement returns an identifier for the first connection on the
current database. The identifier is an integer value like 569851433.
Parameters
Examples
Usage
Standards and
compatibility
Function
Syntax
Parameters
Examples