Hi,
SQL Server local variables are declared using the DECLARE statement, and exist for the duration of the batch in which they are declared.
They are declared with @ prefix.
SQL Server provides a massive number of global variables, which are very effective to use in our regular Transact-SQL. Global variables represent a special type of variable. The server always maintain the values of these variables. All the global variables represent information specific to the server or a current user session.
Global variable names begin with a @@ prefix. You do not need to declare them, since the server constantly maintains them. They are system-defined functions and you cannot declare them.
Mark as answer if satisfied.......
Thank You,
Kavya Shree M.
Kavya Shree Mandapalli
Allemahesh, if this helps please login to Mark As Answer. | Alert Moderator