The SET statement assigns a new value to a variable. The variable must have been previously created using a CREATE VARIABLE
statement or DECLARE statement, or it must be an OUTPUT parameter for a procedure. The variable name can optionally use the
Transact-SQL convention of an @ sign preceding the name. For example:
SET @localvar = 42
A variable can be used in a SQL statement anywhere a column name is allowed. If a column name exists with the same name as
the variable, the variable value is used.
Variables are local to the current connection, and disappear when you disconnect from the database or use the DROP VARIABLE
statement. They are not affected by COMMIT or ROLLBACK statements.
Variables are necessary for creating large text or binary objects for INSERT or UPDATE statements from embedded SQL programs
because embedded SQL host variables are limited to 32,767 bytes.