Returns an identifying number for the next 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 most recent 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.
NEXT_CONNECTION can be used to enumerate the connections to a database. Connection IDs are generally created in monotonically increasing order. This function returns the next connection ID in reverse order.
To get the connection ID value for the most recent connection, enter NULL as the connection-id. To get the subsequent connection, enter the previous return value. The function returns NULL when there are no more connections in the order.
NEXT_CONNECTION is useful if you want to disconnect all the connections created before a specific time. However, because NEXT_CONNECTION returns the connection IDS in reverse order, connections made after the function is started are not returned. If you want to ensure that all connections are disconnected, prevent new connections from being created before you run NEXT_CONNECTION.
SQL/2003 Vendor extension.
The following statement returns an identifier for the first connection on the current database. The identifier is an integer value like 10.
SELECT NEXT_CONNECTION( NULL ); |
The following statement returns a value like 5.
SELECT NEXT_CONNECTION( 10 ); |
The following call returns the next connection ID in reverse order from the specified connection-id on the current database.
SELECT NEXT_CONNECTION( connection-id ); |
The following call returns the next connection ID in reverse order from the specified connection-id (regardless of database).
SELECT NEXT_CONNECTION( connection-id, NULL ); |
The following call returns the next connection ID in reverse order from the specified connection-id on the specified database.
SELECT NEXT_CONNECTION( connection-id, database-id ); |
The following call returns the first (earliest) connection (regardless of database).
SELECT NEXT_CONNECTION( NULL, NULL ); |
The following call returns the first (earliest) connection on the specified database.
SELECT NEXT_CONNECTION( NULL, database-id ); |
Send feedback about this page via email or DocCommentXchange | Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0 |