SQL global variables

Source: Internet
Author: User
Select APP_NAME () as w -- Application of the current session
Select @ ERROR -- return the ERROR code (integer) of the last executed Transact-SQL statement)
Select @ IDENTITY -- return the last inserted id value
SELECT USER_NAME () -- returns the user database username
Select getdate () -- current time
SELECT @ CPU_BUSY/100 -- returns the CPU time since the last SQL statement was started, in milliseconds
SELECT @ IDLE as w -- returns the IDLE time of the SQL statement since it was last started, in milliseconds
SELECT @ IO_BUSY AS w -- returns the time (in milliseconds) of the SQL statement used to perform input and output operations after the last startup.
SELECT @ langid as w -- returns the local language identifier (ID) of the current language ).
SELECT @ language as w -- returns the current LANGUAGE name
SELECT @ MAX_CONNECTIONS as w -- returns the maximum number of simultaneous user connections allowed on SQL. The number returned does not need to be the currently configured value.
Select @ OPTIONS as w -- returns information about the current SET option.
SELECT @ PACK_RECEIVED as w -- returns the number of input data packets read from the network after SQL is started.
SELECT @ PACK_SENT as w -- return the number of output data packets written to the network by SQ since the last start.
SELECT @ PACKET_ERRORS as w -- returns the number of network packet errors that have occurred on the SQL connection since the SQL startup.
SELECT @ SERVERNAME as w -- return the name of the running SQL Server.
SELECT @ SERVICENAME as w -- return the registry key name that is running under the SQL statement.
SELECT @ TIMETICKS as w -- returns the number of microseconds at a scale on the SQL server.
SELECT @ TOTAL_ERRORS AS w -- returns the number of disk read/write errors that the SQL Server encounters after it is started.
SELECT @ TOTAL_READ as w -- returns the number of times the SQL Server reads the disk after it is started.
SELECT @ TOTAL_WRITE as w -- return the number of times the SQL server writes data to the disk after it is started.
SELECT @ TRANCOUNT as w -- returns the number of active transactions for the current connection.
SELECT @ VERSION as w -- returns the date, VERSION, and processor type of the SQL Server installation.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.