If you have some application development experience in any language, then you probably familiar with global variable, global means we can access the value of that variable from any part of that application.
Here we learn how to declare global variable in SQL server, then how to access them.
SQL global variable always starts with double
There are many system defined global variable, which we can access to see the values.
To test some global variable values, simply access following variables in your sql query analyser.
Here is how you can use a global variable in your code.
Select * from [dbo].[tbClient] if (@@ERROR<>0) print 'There is some error' else print 'no error'
If anything goes wrong in sql server, the
@@ERROR variable will be populated with error code.
You may be interested to read following posts