Adaptive Server’s global variables

The following are the global variables available for Adaptive Sever:

Global variable

Definition

@@boottime

Returns the date and time Adaptive Server was last booted.

@@char_convert

Returns 0 if character set conversion is not in effect. Returns 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. Formore information, see the Component Integration Services User’s Guide.

@@cis_version

Returns the date andversion of Component Integration Services.

@@client_csexpansion

Returns the expansion factor used when converting from the server character set to the client character set. For example, if it contains a value of 2, a character in the server character set could take up to twice the number of bytes after translation 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.

@@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 number of seconds, in CPU time, that Adaptive Server's CPU was performing Adaptive Server work.

@@curloid

Returns the current session’s lock owner ID.

@@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 errorlog is kept, relative to $SYBASE directory (%SYBASE% on NT).

@@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. Used only in a high availability environment, and is session-specific.

@@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. This is a session-specific property.

@@heapmemsize

Returns the size of the heap memory pool, in bytes. See the System Administration Guide for more information on heap memory.

@@identity

Returns the most recently generated IDENTITY column value.

@@idle

Returns the number of seconds, in CPU time, that Adaptive Server has been idle.

@@invaliduserid

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

@@io_busy

Returns the number of seconds in CPU time 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.

@@kernel_addr

Returns the starting address of the first shared memory region that contains the kernel region. The result is in the form of 0xaddress pointer value.

@@kernel_size

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

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

@@maxcharlen

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

@@max_connections

Returns the maximum number of simultaneous connections that can be made with Adaptive Server in the current computer environment. You can configure Adaptive Server for any number of connections less than or equal to the value of @@max_connections with the number of user connections configuration parameter.

@@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. The result is in the form 0xaddress pointer value. This variable is for internal use.

@@mingroupid

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

@@min_poolsize

Returns the minimum size of a named cache pool, in kilobytes. It is calculated based on the DEFAULT_POOL_SIZE, which is 256, and the current value of max database page size.

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

@@ncharsize

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

@@nestlevel

Returns the current nesting level.

@@nodeid

Returns the current installation's node ID. Adaptive Server generates a nodeid the first time the master device is first used

@@options

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

@@packet_errors

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

@@pack_received

Retruns the number of input packets read by Adaptive Server.

@@pack_sent

Returns the nmber of output packets written by Adaptive Server.

@@pagesize

Returns the server’s virtual page size.

@@parallel_degree

Returns the current maximum parallel degree setting.

@@probesuid

Returns a value of 2 for the probe user ID.

@@procid

Returns the stored procedure ID of the currently executing procedure.

@@rowcount

Returns the number of rows affected by the last query. @@rowcount is set to 0 by any command that does not return rows, such as an if, update, or delete statement. With cursors, @@rowcount represents the cumulative number of rows returned from the cursor result set to the client, up to the last fetch request.

@@scan_parallel_degree

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

@@servername

Returns the name of Adaptive Server.

@@shmem_flags

Returns the shared memory region properties. This variable is for internal use. There are a total of 13 different properties values corresponding to 13 bits in the integer. The valid values represented from low to high bit are:

MR_SHARED, MR_SPECIAL, MR_PRIVATE, MR_READABLE, MR_WRITABLE, MR_EXECUTABLE, MR_HWCOHERENCY, MR_SWCOHERENC, MR_EXACT, MR_BEST, MR_NAIL, MR_PSUEDO, MR_ZERO.

@@spid

Returns the server process ID of the current process.

@@sqlstatus

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

@@stringsize

Returns the amount of character data returned from a toString() method. The default is 50. Max values may be up to 2GB. A value of zero specifies the default value. For more information, see the Component Integration Services User’s Guide.

@@textcolid

Returns the column ID of 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.

@@textptr

Returns the text pointer of the last text or image column 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 configuration parameter is off. Returns 1 if the current status of the textptr_parameters if on. For more information, see the Component Integration Services User’s Guide.

@@textsize

Returns the limit on the number of bytes of text or image data a select returns. Default limit is 32K bytes for isql; the default depends on the client software. Can be changed for a session with set textsize.

@@textts

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

@@thresh_hysteresis

Returns the decrease in free space required to activate a threshold. This amount, also known as the hysteresis value, is measured in 2K database pages. It determines how closely thresholds can be placed on a database segment.

@@timeticks

Returns the number of microseconds per tick. The amount of time per tick is machine-dependent.

@@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. Returns 1 if the current transaction mode of the Transact-SQL program is chained.

@@trancount

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

@@transactional_rpc

Returns 0 if RPCs to remote servers are transactional. Returns 1 if RPCs to remote servers are not transactional. For more information, see enable xact coordination and set option transactional_rpc in the Reference Manual. Also, see the Component Integration Services User’s Guide.

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

@@version

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

@@version_as_integer

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