Contents Index NEWID function [Miscellaneous] NEXT_DATABASE function [System]

ASA SQL Reference
  SQL Functions
    Alphabetical list of functions

NEXT_CONNECTION function [System]


Function 

Returns an identifying number for a connection.

Syntax 

NEXT_CONNECTION ( [ connection-id  ] [, database-id ] )

Parameters 

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.

Usage 

NEXT_CONNECTION can be used to enumerate the connections to a database. To get the first connection pass NULL; to get each subsequent connection, pass the previous return value. The function returns NULL when there are no more connections.

Standards and compatibility 
Example 

The following statement returns an identifier for the first connection on the current database. The identifier is an integer value like 569851433.

SELECT NEXT_CONNECTION( NULL )

The following statement returns a value like 1661140050.

SELECT NEXT_CONNECTION( 569851433 )

The following call returns the connection after connection-id on the current database.

NEXT_CONNECTION( connection-id )

The following call returns the connection after connection-id (regardless of database).

NEXT_CONNECTION( connection-id, NULL )

The following call returns the connection after connection-id on the specified database.

NEXT_CONNECTION( connection-id, database-id )

The following call returns the first connection (regardless of database).

NEXT_CONNECTION(NULL, NULL)

The following call returns the first connection on the specified database.

NEXT_CONNECTION( NULL, database-id )

Contents Index NEWID function [Miscellaneous] NEXT_DATABASE function [System]