According to MSDN , the correct name for them is system functions .
The naming confusion (global variable, system function, global function) stems from the various terms used in the history of SQL Server. From the MSDN Transact-SQL Variables article :
The names of some Transact-SQL system functions begin with two characters (@@). Although in earlier versions of Microsoft SQL Server, @@ Functions are called global variables, they are not variables and do not have the same behavior as variables. The @@ functions are system functions, and their use of syntax follows the rules for functions.
Thus, the two characters "at" (@@) are used to denote some system functions. The use of the phrase “global variable” was deprecated (although you will still see some use it ), most likely because in the programming world a global variable is one value that is visible everywhere, and, as already mentioned, it’s not that happening here (e.g. @@IDENTITY ).
Further confusion is most likely caused by the name of the temporary tables. One hash character, a table name prefix, indicates a temporary table of a locally localized area (e.g., #MyLocalTable ), very similar to a single in a symbol representing a local range variable (e.g., @MyLocalVariable ). Adding a second hash character to a temporary table makes it global (for example, ##MyGlobalTable ), but trying to add two characters to a variable does not have the same effect .
source share