Chapter 6 SQL Language Elements
257
Global variable Returns
to activate a threshold. In Adaptive Server Anywhere,
returns 0
@@timeticks In Adaptive Server Enterprise, number of microseconds per
tick. The amount of time per tick is machine-dependent. In
Adaptive Server Anywhere, returns 0
@@total_errors In Adaptive Server Enterprise, number of errors that have
occurred while Adaptive Server Enterprise was reading or
writing. In Adaptive Server Anywhere, returns 0.
@@total_read In Adaptive Server Enterprise, number of disk reads by
Adaptive Server Enterprise since it was last started. In
Adaptive Server Anywhere, returns 0
@@total_write In Adaptive Server Enterprise, number of disk writes by
Adaptive Server Enterprise since it was last started. In
Adaptive Server Anywhere, returns 0
@@tranchained Current transaction mode of the Transact-SQL program.
@@tranchained returns 0 for unchained or 1 for chained
@@trancount Nesting level of transactions. Each BEGIN
TRANSACTION in a batch increments the transaction count
@@transtate In Adaptive Server Enterprise, current state of a transaction
after a statement executes. In Adaptive Server Anywhere,
returns –1
@@version Information on the current version of Adaptive Server
Enterprise or Adaptive Server Anywhere
@@identity global variable
The @@identity variable holds the most recent value inserted into an
IDENTITY column or a DEFAULT AUTOINCREMENT column, or zero if
the most recent insert was into a table that had no such column.
The value of @@identity is reset each time a row is inserted into a table. If a
statement inserts multiple rows, @@identity reflects the IDENTITY value
for the last row inserted. If the affected table does not contain an IDENTITY
column, @@ identity is set to 0.
The value of @@identity is not affected by the failure of an INSERT or
SELECT INTO statement, or the rollback of the transaction that contained it.
@@identity retains the last value inserted into an IDENTITY column, even
if the statement that inserted it fails to commit.