All global variables in SQL Server are prefixed with two @ symbols
--[email protected] @error The error number of the last T-SQL error (the error number for which the constraint was to be violated)Insert intoSubjectValues('Test Engineer')--violation of the constraintSelect @ @ERROR --[email protected] @identity the last marked value insertedInsert intoSubject (Subjectname, Classhour, Gradeid)--Subjectid primary key, self-incrementValues('all right.',' -',1)Select @ @identity --If the above is added for the first time, 1 is returned--Note: If you delete the statement you added above using the DELETE statement--then select @ @identity, the return is 1--[email protected] @language The language currently in useSelect @ @language --[email protected] @rowcount The number of rows affected by the previous SQL statementSelect * fromSubject--if we find the N data,Select @ @rowcount --The value returned is n--[email protected] @SERVERNAME The name of the local serverSelect @ @SERVERNAME --The value returned is 123-PC--[email protected] @SERVICENAME The name of the SQL service on this computerSelect @ @SERVICENAME --The value returned is MSSQLSERVER--[email protected] @TIMETICKS the number of microseconds per tick on the current computer depends on the amount of time on the computer. The operating system's scale is 31.25 milliseconds, or one-thirtieth seconds. Select @ @TIMETICKS --The value returned is 31250--[email protected] @TRANCOUNT--the BEGIN TRANSACTION statement increases the @ @TRANCOUNT by 1. ROLLBACK TRANSACTION decrements the @ @TRANCOUNT to 0, except for ROLLBACK TRANSACTION savepoint_name, which does not affect @ @TRANCOUNT. Commit TRANSACTION or commit work decrements the @ @TRANCOUNT by 1. --when dealing with transactions, it is common to roll back and forth with rollback TRANSACTION, but if this is used in nested transactions, an error occurs. --in SQL Server, the hierarchy of nested transactions is reflected by the @ @TranCount global variables. Each time the BEGIN transaction will cause @ @TranCount plus 1. Each commit transaction the @ @TranCount minus 1, while the rollback TRANSACTION rolls back all nested transactions, including committed transactions and uncommitted transactions, leaving the @ @TranCount at 0. For example:--Begin Transaction--@ @TranCount = 1--BeginTransaction--@ @TranCount = 2--BeginTransaction--@ @TranCount = 3--Commit Transaction--@ @TranCount = 2--Commit Transaction--@ @TranCount = 1--Commit Transaction--@ @TranCount = 0--If there is an error rollback TRANSACTION--Then:--Begin Transaction--@ @TranCount = 1--BeginTransaction--@ @TranCount = 2--BeginTransaction--@ @TranCount = 3--ROLLBACK TRANSACTION--@ @TranCount = 0--Commit Transaction--@ @TranCount = 0---An error occurred--Transaction count After EXECUTE indicates, a COMMIT or ROLLBACK Transaction statement is missing. Previous count = 1, current count = 0.--If an error occurs in a nested transaction, the simplest method should be to commit it anyway, and return the error code (a code that is not normally possible, such as-1) to let the previous transaction handle the error, thereby reducing the @ @TranCount by 1. This allows the outer transaction to be rolled back or committed to ensure that the outer transaction is consistent at the beginning and at the end. Because the inner transaction returns an error code, the outer transaction (outermost layer) can roll back the transaction so that the committed transaction can be rolled back without error. Select @ @TRANCOUNT--[email protected] @VERSION version information for SQL ServerSelect @ @VERSION --the value returned by Microsoft SQL Server R2 (RTM)-10.50.1600.1 (Intel X86) APR 2 15:53:02 Copyright (c) Microsoft Co Rporation Enterprise Edition on Windows NT 6.1 <X86> (Build 7601:service Pack 1)--10. Maximum number of simultaneous connections that can be createdSelect @ @MAX_CONNECTIONS --The value returned is 32767
where 8.TRANSOUNT details https://msdn.microsoft.com/zh-cn/library/ms187967.aspx
10.max_connections Details http://blog.hehehehehe.cn/a/668.htm
SQL Server Global Variables