Enterprise Edition Home | Express Edition Home | Previous Page | Next Page   SQL Statements > GET DIAGNOSTICS >

The Contents of the SERVER_NAME Field

The SERVER_NAME field contains different information after you execute the following statements.

Executed Statement
SERVER_NAME Field Contents
CONNECT
Contains the name of the database server to which you connect or fail to connect Field is blank if you do not have a current connection or if you make a default connection.
SET CONNECTION
Contains the name of the database server to which you switch or fail to switch
DISCONNECT
Contains the name of the database server from which you disconnect or fail to disconnect If you disconnect and then you execute a DISCONNECT statement for a connection that is not current, the SERVER_NAME field remains unchanged.
DISCONNECT ALL
Sets the field to blank if the statement executes successfully If the statement fails, SERVER_NAME contains the names of all the database servers from which you did not disconnect. (This information does not mean that the connection still exists.)

If CONNECT succeeds, SERVER_NAME is set to one of the following values:

The DATABASE Statement

When you execute a DATABASE statement, the SERVER_NAME field contains the name of the database server on which the database resides.

Using the CONNECTION_NAME Keyword

Use the CONNECTION_NAME keyword to return the name of the connection specified in your CONNECT or SET CONNECTION statement.

When the CONNECTION_NAME Keyword Is Updated

GET DIAGNOSTICS updates the CONNECTION_NAME field when the following situations occur:

When the CONNECTION_NAME Is Not Updated

The CONNECTION_NAME field is not updated in the following cases:

The CONNECTION_NAME field retains the value set in the previous SQL statement. If any of the preceding conditions occurs on the first SQL statement that executes, the CONNECTION_NAME field is blank.

An implicit connection has no name. After a DATABASE statement successfully creates an implicit connection, the CONNECTION_NAME field is blank.

Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]