Global variables

This section describes changes to global variables.

Table 15-4: Global variables added for the Cluster Edition

Global variable

Definition

@@instanceid

Returns the id of the instance from which it was executed

@@active_instances

Returns the number of active instances in the cluster

@@clusterboottime

Returns the date and time the cluster was first started, even if the instance that originally started the cluster start has shut down

@@clustercoordid

Returns the instance id of the current cluster coordinator

@@clustermode

Returns the string: “shared-disk cluster”

@@clustername

Returns the name of the cluster

@@instancename

Returns the name of the instance from which it was executed

@@jsinstanceid

Id of the instance on which the Job Scheduler is running, or will run once enabled

@@quorum_physname

Returns the physical path for the quorum device

@@system_busy

Number of ticks during which Adaptive Server was running a system task1

@@sys_tempdbid

Returns the database id of the executing instance’s effective local system temporary database

@@system_view

Returns the session-specific system view setting, either “instance” or “cluster”

@@user_busy

Number of ticks during which Adaptive Server was running a user task1

1The value of @@user_busy + @@system_busy should equal the value of @@cpu_busy

Considerations for global variables in a clustered environment

For @@servername, the Cluster Edition returns the name of the cluster, not the instance name. Use @@instancename to return the name of the instance.

In a non-clustered Adaptive Server environment, the value for @@identity changes for every record inserted. If the most recent record inserted contains a column with the IDENTITY property, @@identity is set to the value of this column, otherwise it is set to “0” (an invalid value). This variable is session-specific, and takes its value based on the last insert that occurred during this session.

In a clustered environment, multiple nodes perform inserts on tables, so the session-specific behavior is not retained for @@identity. In a clustered environment, the value for @@identity depends on the last record inserted in the node for the current session and not on the last record inserted in the cluster.