Skip to content

DECLARE

DECLARE @MyVar int;
SET @MyVar = 5;
SELECT @MyVar AS 'Value';
| Value |
|-------|
| 5 |

In the given example, a declaration of an integer variable @MyVar is made, and it is set to 5. The SELECT statement is then used to display the value of @MyVar.