SET Statement

Assigns a new value to a previously declared variable. The new value does not need to be of the same type as the previous value. It is an error to assign a value to an undeclared variable. Use the DECLARE statement to declare variables.

Syntax

SET variable-name = new-value;

Parameters

Example

DECLARE @a = 1;
SET @a = 2;