Variables, Parameters, and Return Codes
Variables provide a way to manipulate, store, and pass data within a stored procedure as well as between stored procedures and functions. SQL Server has two types of variables: local and global. A local variable is designated by a single @ symbol whereas a global variable is designated by a double @@ symbol. Additionally, you can create, read, and write local variables whereas you can’t create or write to global variables. Table 12-1 lists some of the more common global variables.
Table 12-1. Global Variables
Error code from the last statement executed
Value of the last identity value inserted within the connection
The number of rows affected by the ...