BISQL # 82 – SQL Server Global Variable #4 – Global Variable 36 of 36 – Detailed explanation and Example
Hi folks,
Now Today I have decided to complete all list of Global Variable .
So following is links of this series from where I have started explaining Global Variable.
- SQL Server Global Variable #1 – Introduction of Global Variable
- SQL Server Global Variable #2 – Global Variable 12 of 36
- SQL Server Global Variable #3 – Global Variable 24 of 36
- SQL Server Global Variable #4 – Global Variable 36 of 36 (This post)
- SQL Server Global Variable #5 – Summery of SQL Server Global Variable
In this Article we are going to cover
- @@DATEFIRST
- @@DEF_SORTORDER_ID
- @@DEFAULT_LANGID
- @@FETCH_STATUS
- @@LOCK_TIMEOUT
- @@MAX_PRECISION
- @@NESTLEVEL
- @@OPTIONS
- @PROCID
- @@REMSERVER
I know two of Global variable I have missed we will complete that too in my last post on Global Variable series
Now lets understand and Complete the list of remaining Global Variables
@@DATEFIRST
This Global variable returns the current value, for a session, of SET DATEFIRST.
Help Script
SELECT @@DATEFIRST AS '@@DATEFIRST the current value, for a session'
Output
@@DEF_SORTORDER_ID
This Global variable is to provide deferential sort order ID
Help Script
SELECT @@DEF_SORTORDER_ID AS ' @@DEF_SORTORDER_ID provides differential SORTORDER_ID'
Output
@@DEFAULT_LANGID
This Global variable provides Default Login ID.
Returns 0 if No login ID is Default
Help Script
SELECT @@DEFAULT_LANGID AS ' @@DEFAULT_LANGID'
Output
@@FETCH_STATUS
This Global variable returns the status of the last cursor FETCH statement issued against any cursor currently opened by the connection.
Help Script
SELECT @@FETCH_STATUS AS ‘@@FETCH_STATUS gives status of the last cursor’
Output
@@LOCK_TIMEOUT
This Global variable is to 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.
-1 Represent this time has not been set.
Help Script
SELECT @@LOCK_TIMEOUT AS ‘@@LOCK_TIMEOUT to set the maximum time that a statement’
Output
@@MAX_PRECISION
This Global variable the precision level used by decimal and numeric data types as currently set in the server.
By default, the maximum precision returns 38
Help Script
SELECT @@MAX_PRECISION AS '@@MAX_PRECISION precision level used by decimal and numeric data'
Output
@@NESTLEVEL
This Global variable returns 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.
Help Script
SELECT @@NESTLEVEL AS '@@NESTLEVEL the nesting level of the current stored procedure'
Output
@@OPTIONS
This Global variable returns information about the current SET options
Help Script
SELECT @@OPTIONS AS '@@OPTIONS is information about the current SET options'
Output
@@PROCID
This Global variable 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.
Help Script
SELECT @@PROCID AS '@@PROCID is the object identifier (ID) of the current Transact-SQL module'
Output
@@REMSERVER
This Global variable enables a stored procedure to check the name of the database server from which the procedure is run
Help Script
SELECT @@REMSERVER AS '@@REMSERVER is enables a stored procedure to check the name DB'
Output
Note : Last but not least one i.e. summery post on Global Variable i will be completing after having more analysis on Global Variable Section !!
Hope this Helps !!!!
Thanks for visiting my blog !!
Hope you will like this post on Details of 12 Global Variable and explanation with example.
If you really like reading my blog and understood at lest few thing then please don’t forget to subscribe my blog .
If you wan daily link and analysis or interesting link go to following website which will give @ your inbox please subscribe our following link resource blog
Where todays links are