Skip to content

VALUE

DECLARE @MyVar AS INT;
SET @MyVar = 5;
SELECT VALUE = @MyVar;
VALUE
5

In the code provided, a variable @MyVar is declared as an integer (INT) data type in SQL Server. The SET statement is then used to assign the number 5 to @MyVar. Finally, the SELECT statement, used with the VALUE keyword, outputs the current value of @MyVar, which is 5. The VALUE keyword helps assign a column alias in the ‘SELECT’ statement output.