let us learn the global variables in the sql server , in my last article we had already learned about global variables and we also learned the first 10 global variables .This article is continuation to the Global Variables in Sql Server Part-1
Introduction
In this article we are going to learn the global variables in the Sql Server , in my last article on global variables we had learned about global variables and the usage of first 10 global variables in Sql Server .
To visit the first part of this article, click here.
List of second 10 Global Variables and their usage are included below:
1)@@LANGID : The local language id of the language currently in use(specified in syslanguages.langid).By default it will return 0 because the language id of the english is 0.we can set the language id based on our requirement.
Example
select
@@LANGID as Language_ID
2)@@LANGUAGE : The name of the language currently in use (specified in
syslanguages.name).By default it will return us_english Language.
Example
select
@@LANGUAGE as System_Language
3)@@LOCK_TIMEOUT : Number of milliseconds the connection will wait for a source that is currently blocked . After that time period the connection will time out and retuen an error.
Example
select
@@LOCK_TIMEOUT AS LOCKTIMEOUT
4)@@MAX_CONNECTIONS : The maximum number of simultaneous connections that can be made with
SQL Server in this computer environment. The user can configure SQL Server for
any number of connections less than or equal to the value of
@@max_connections with sp_configure ''number of user
connections''.
Example
select
@@MAX_CONNECTIONS AS MAXIMUMCONNECTIONS
5)@@MAX_PRECISION : Maximum precision allowed for decimal and numeric data types
Example
select
@@MAX_PRECISION PRECISION_ALLOWED
6)@@NESTLEVEL : The current level of stored procedure nesting. If there are no currently executing nested procedures then this variable is zero
Example
select
@@NESTLEVEL AS
7)@@OPTIONS : Returns a bitmask of currently active SET options. Some SET options can be altered by each user, however, each connection starts up with the same options, as configured by the system administrator
Example
select
@@OPTIONS AS OPTIONS_SYSTEM
8)@@PACKET_ERRORS : Number of network packet errors since SQL Server was last StartedNumber of network packet errors since SQL Server was last started
Example
select
@@PACKET_ERRORS AS ERROR_PACKET
9)@@PACK_RECEIVED : Number of network packets received by SQL Server since it was last started
Example
select
@@PACK_RECEIVED AS RECEIVED_PACKETS
10)@@PACK_SENT : Number of network packets sent by SQL Server since it was last started
Example
select
@@PACK_SENT AS SENT_PACKETS
Conclusion
In this article we had learned the 10 important global variables which is continuation to global variables part1
Below is the link of my first article on Global variables in Sql Server part -http://www.dotnetfunda.com/articles/article2015-global-variables-in-sql-server-part1.aspx
Reference
http://manuals.sybase.com/onlinebooks/group-asarc/srg1100e/sqlref/@Generic__BookTextView/72481;pt=73386