Adaptive Server global variables

These are the global variables and their brief descriptions for Adaptive Server. See Reference Manual: Building Blocks for complete information.

@@active_instances

Returns the number of active instances in the cluster.

@@authmech

Indicates the mechanism used to authenticate the user.

@@bootcount

Returns the number of times an installation has been booted.

@@boottime

Returns the date and time Adaptive Server was last booted.

@@bulkarraysize

Returns the number of rows to be buffered in local server memory before being transferred using the bulk copy interface.

@@bulkbatchsize

Returns the number of rows transferred to a remote server via select into proxy_table using the bulk interface.

@@char_convert

Returns 0 if character set conversion is not in effect, 1 if character set conversion is in effect.

@@cis_rpc_handling

Returns 0 if cis rpc handling is off. Returns 1 if cis rpc handling is on.

@@cis_version

Returns the date and version of Component Integration Services.

@@client_csexpansion

Returns the expansion factor used when converting from the server character set to the client character set.

@@client_csid

Returns -1 if the client character set has never been initialized; returns the client character set ID from syscharsets for the connection if the client character set has been initialized.

@@client_csname

Returns NULL if client character set has never been initialized; returns the name of the character set for the connection if the client character set has been initialized.

@@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.

@@cmpstate

Returns the current mode of Adaptive Server in a high availability environment.

@@connections

Returns the number of user logins attempted.

@@cpu_busy

Returns the amount of time, in ticks, that the CPU has spent doing Adaptive Server work since the last time Adaptive Server was started.

@@cursor_rows

Displays the total number of rows in the cursor result set.

@@curloid

Either no cursors are open, no rows qualify for the last opened cursor, or the last open cursor is closed or deallocated.

@@datefirst

Returns the current value of @@datefirst, indicating the specified first day of each week, expressed as tinyint.

@@dbts

Returns the timestamp of the current database.

@@error

Returns the error number most recently generated by the system.

@@errorlog

Returns the full path to the directory in which the Adaptive Server error log is kept, relative to $SYBASE directory.

@@failedoverconn

Returns a value greater than 0 if the connection to the primary companion has failed over and is executing on the secondary companion server.

@@fetch_status

Returns 0 if fetch operation is successful or -1 if fetch operation is unsuccessful. -2 is reserved for future use.

@@guestuserid

Returns the ID of the guest user.

@@hacmpservername

Returns the name of the companion server in a high availability setup.

@@haconnection

Returns a value greater than 0 if the connection has the failover property enabled.

@@heapmemsize

Returns the size of the heap memory pool, in bytes.

@@identity

Returns the most recently generated IDENTITY column value.

@@idle

Returns the amount of time, in ticks, that Adaptive Server has been idle since it was last started.

@@invaliduserid

Returns a value of -1 for an invalid user ID.

@@instanceid

Returns the id of the instance from which it was executed

@@instancename

Returns the name of the instance from which it was executed

@@invaliduserid

Returns a value of -1 for an invalid user ID.

@@io_busy

Returns the amount of time, in ticks, that Adaptive Server has spent doing input and output operations.

@@isolation

Returns the value of the session-specific isolation level (0, 1, or 3) of the current Transact-SQL program.

@@instanceid

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

@@kernel_addr

Returns the starting address of the first shared memory region that contains the kernel region.

@@kernel_size

Returns the size of the kernel region that is part of the first shared memory region.

@@kernelmode

Returns the mode (threaded or process) for which Adaptive Server is configured.

@@langid

Returns the server-wide language ID of the language in use, as specified in syslanguages.langid.

@@language

Returns the name of the language in use, as specified in syslanguages.name.

@@lastkpgendate

Returns the date and time of when the last key pair was generated as set by the sp_passwordpolicy “keypair regeneration period” policy option.

@@lastlogindate

Includes a datetime datatype, its value is the lastlogindate column for the login account before the current session was established.

@@lock_timeout

Returns the current lock_timeout setting, in milliseconds.

@@lwpid

Returns the object ID of the next most recently run lightweight procedure.

@@max_connections

Returns the maximum number of simultaneous connections that can be made with Adaptive Server in the current computer environment.

@@max_precision

Returns the precision level used by decimal and numeric datatypes set by the server. This value is a fixed constant of 38.

@@maxcharlen

Returns the maximum length, in bytes, of a character in Adaptive Server's default character set.

@@maxgroupid

Returns the highest group user ID. The highest value is 1048576.

@@maxpagesize

Returns the server’s logical page size.

@@maxspid

Returns maximum valid value for the spid.

@@maxsuid

Returns the highest server user ID. The default value is 2147483647.

@@maxuserid

Returns the highest user ID. The highest value is 2147483647.

@@mempool_addr

Returns the global memory pool table address.

@@min_poolsize

Returns the minimum size of a named cache pool, in kilobytes.

@@mingroupid

Returns the lowest group user ID. The lowest value is 16384.

@@minspid

Returns 1, which is the lowest value for spid.

@@minsuid

Returns the minimum server user ID. The lowest value is -32768.

@@minuserid

Returns the lowest user ID. The lowest value is -32768.

@@monitors_active

Reduces the number of messages displayed by sp_sysmon.

@@ncharsize

Returns the maximum length, in bytes, of a character set in the current server default character set.

@@nestlevel

Returns the current nesting level.

@@nextkpgendate

Returns the date and time of when the next key pair scheduled to be generated, as set by sp_passwordpolicy “keypair regeneration period” policy option.

@@nodeid

Returns the current installation's 48-bit node identifier.

@@optgoal

Returns the current optimization goal setting for query optimization

@@options

Returns a hexadecimal representation of the session’s set options.

@@optlevel

Returns the currently optimization level setting.

@@opttimeoutlimit

Returns the current optimization timeout limit setting for query optimization

@@ospid

(Threaded mode only) Returns the operating system ID for the server.

@@pack_received

Retruns the number of input packets read by Adaptive Server.

@@pack_sent

Returns the nmber of output packets written by Adaptive Server.

@@packet_errors

Returns the number of errors detected by Adaptive Server while reading and writing packets.

@@pagesize

Returns the server’s virtual page size.

@@parallel_degree

Returns the current maximum parallel degree setting.

@@plwpid

Returns the object ID of the most recently prepared lightweight procedure.

@@probesuid

Returns a value of 2 for the probe user ID.

@@procid

Returns the stored procedure ID of the currently executing procedure.

@@quorum_physname

Returns the physical path for the quorum device

@@recovery_state

Indicates whether Adaptive Server is in recovery based on these returns

@@remotestate

(High-availability only) Returns the current mode of the primary companion in a high availability environment.

@@repartition_degree

Returns the current dynamic repartitioning degree setting

@@resource_granularity

Returns the maximum resource usage hint setting for query optimization

@@rowcount

Returns the number of rows affected by the last query.

@@scan_parallel_degree

Returns the current maximum parallel degree setting for nonclustered index scans.

@@servername

Returns the name of Adaptive Server.

@@setrowcount

Returns the current value for set rowcount

@@shmem_flags

Returns the shared memory region properties.

@@spid

Returns the server process ID of the current process.

@@sqlstatus

Returns status information (warning exceptions) resulting from the execution of a fetch statement.

@@ssl_ciphersuite

Returns NULL if SSL is not used on the current connection; otherwise, it returns the name of the cipher suite you chose during the SSL handshake on the current connection.

@@stringsize

Returns the amount of character data returned from a toString() method.

@@sys_tempdbid

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

@@system_busy

Number of ticks during which Adaptive Server was running a system task.

@@system_view

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

@@tempdbid

Returns a valid temporary database ID (dbid) of the session’s assigned temporary database.

@@textcolid

Returns the column ID of the column referenced by @@textptr.

@@textdataptnid

Returns the partition ID of a text partition containing the column referenced by @@textptr.

@@textdbid

Returns the database ID of a database containing an object with the column referenced by@@textptr.

@@textobjid

Returns the object ID of an object containing the column referenced by @@textptr.

@@textptnid

Returns the partition ID of a data partition containing the column referenced by @@textptr.

@@textptr

Returns the text pointer of the last text, unitext, or image inserted or updated by a process (Not the same as the textptr function).

@@textptr_parameters

Returns 0 if the current status of the textptr_parameters is off, and 1 if the current status of the textptr_parameters if on.

@@textsize

Returns the limit on the number of bytes of text, unitext, or image data a select returns.

@@textts

Returns the text timestamp of the column referenced by @@textptr.

@@thresh_hysteresis

Returns the decrease in free space required to activate a threshold.

@@timeticks

Returns the number of microseconds per tick.

@@total_errors

Returns the number of errors detected by Adaptive Server while reading and writing.

@@total_read

Returns the number of disk reads by Adaptive Server.

@@total_write

Returns the number of disk writes by Adaptive Server.

@@tranchained

Returns 0 if the current transaction mode of the Transact-SQL program is unchained, and 1 if chained.

@@trancount

Returns the nesting level of transactions in the current user session.

@@transactional_rpc

Returns 0 if RPCs to remote servers are transactional, and 1 if not transactional.

@@transtate

Returns the current state of a transaction after a statement executes in the current user session.

@@unicharsize

Returns 2, the size of a character in unichar.

@@user_busy

Number of ticks during which Adaptive Server was running a user task.

@@version

Returns the date, version string, and so on of the current release of Adaptive Server.

@@version_as_integer

Returns the number of the last upgrade version of the current release of Adaptive Server as an integer.

@@version_number

Returns the whole version of the current release of Adaptive Server as an integer