@@ Keywords in sql server



SQL Server @@ Keywords (Transact-SQL)
@@CONNECTIONS
Returns the number of attempted connections, either successful or unsuccessful since SQL Server was last started.
@@MAX_CONNECTIONS is the maximum number of connections allowed simultaneously to the server.
@@CONNECTIONS is incremented with each login attempt, therefore @@CONNECTIONS can be greater than @@MAX_CONNECTIONS.


@@CPU_BUSY
Returns the time that SQL Server has spent working since it was last started. Result is in CPU time increments, or "ticks," and is cumulative for all CPUs, so it may exceed the actual elapsed time.


@@CURSOR_ROWS
Returns the number of qualifying rows currently in the last cursor opened on the connection.


@@DATEFIRST
Returns the current value, for a session, of SET DATEFIRST.
SET DATEFIRST specifies the first day of the week. The U.S. English default is 7, Sunday.


@@DBTS
@@DBTS returns the last-used timestamp value of the current database. A new timestamp value is generated when a row with a timestamp column is inserted or updated.


@@ERROR
Returns the error number for the last Transact-SQL statement executed.


@@FETCH_STATUS
Returns the status of the last cursor FETCH statement issued against any cursor currently opened by the connection.


@@IDENTITY
Is a system function that returns the last-inserted identity value.


@@IDLE
Returns the time that SQL Server has been idle since it was last started. The result is in CPU time increments, or "ticks," and is cumulative for all CPUs, so it may exceed the actual elapsed time.


@@IO_BUSY
Returns the time that SQL Server has spent performing input and output operations since SQL Server was last started. The result is in CPU time increments ("ticks"), and is cumulative for all CPUs, so it may exceed the actual elapsed time.


@@LANGID
Returns the local language identifier (ID) of the language that is currently being used.


@@LANGUAGE
Returns the name of the language currently being used.


@@LOCK_TIMEOUT
SET LOCK_TIMEOUT allows an application to set the maximum time that a statement waits on a blocked resource. When a statement has waited longer than the LOCK_TIMEOUT setting, the blocked statement is automatically canceled, and an error message is returned to the application.
@@LOCK_TIMEOUT returns a value of -1 if SET LOCK_TIMEOUT has not yet been run in the current session.


@@MAX_CONNECTIONS
Returns the maximum number of simultaneous user connections allowed on an instance of SQL Server. The number returned is not necessarily the number currently configured.


@@MAX_PRECISION
Returns the precision level used by decimal and numeric data types as currently set in the server.
By default, the maximum precision returns 38.


@@NESTLEVEL
Returns the nesting level of the current stored procedure execution (initially 0) on the local server.
When @@NESTLEVEL is executed within a Transact-SQL string, the value returned is 1 + the current nesting level. When @@NESTLEVEL is executed dynamically by using sp_executesql the value returned is 2 + the current nesting level.


@@OPTIONS
Returns information about the current SET options.


@@PACK_RECEIVED
Returns the number of input packets read from the network by SQL Server since it was last started.


@@PACK_SENT
Returns the number of output packets written to the network by SQL Server since it was last started.


@@PACKET_ERRORS
Returns the number of network packet errors that have occurred on SQL Server connections since SQL Server was last started.


@@PROCID
Returns the object identifier (ID) of the current Transact-SQL module. A Transact-SQL module can be a stored procedure, user-defined function, or trigger. @@PROCID cannot be specified in CLR modules or the in-process data access provider.


@@REMSERVER
@@REMSERVER enables a stored procedure to check the name of the database server from which the procedure is run.


@@ROWCOUNT
Returns the number of rows affected by the last statement. If the number of rows is more than 2 billion, use ROWCOUNT_BIG.


@@SERVERNAME
Returns the name of the local server that is running SQL Server.


@@SERVICENAME
Returns the name of the registry key under which SQL Server is running. @@SERVICENAME returns 'MSSQLSERVER' if the current instance is the default instance; this function returns the instance name if the current instance is a named instance.


@@SPID
Returns the session ID of the current user process.
@@SPID can be used to identify the current user process in the output of sp_who.


@@TEXTSIZE
Returns the current value of the TEXTSIZE option.


@@TIMETICKS
Returns the number of microseconds per tick.
The amount of time per tick is computer-dependent. Each tick on the operating system is 31.25 milliseconds, or one thirty-second of a second.


@@TOTAL_ERRORS
Returns the number of disk write errors encountered by SQL Server since SQL Server last started.


@@TOTAL_READ
Returns the number of disk reads, not cache reads, by SQL Server since SQL Server was last started.


@@TOTAL_WRITE
Returns the number of disk writes by SQL Server since SQL Server was last started.


@@TRANCOUNT
Returns the number of active transactions for the current connection.
The BEGIN TRANSACTION statement increments @@TRANCOUNT by 1. ROLLBACK TRANSACTION decrements @@TRANCOUNT to 0, except for ROLLBACK TRANSACTION savepoint_name, which does not affect @@TRANCOUNT. COMMIT TRANSACTION or COMMIT WORK decrement @@TRANCOUNT by 1.

@@VERSION
Returns version, processor architecture, build date, and operating system for the current installation of SQL Server.