Return the variable value : Set « Transact SQL « SQL Server / T-SQL Tutorial






4>
5> DECLARE @MyNumber Int, @MyResult Int
6> SELECT @MyResult
7>
8> SET @MyNumber = 144
9> SET @MyResult = SQRT(@MyNumber)
10> GO

-----------
       NULL

(1 rows affected)
1>
2>








20.4.Set
20.4.1.Syntax for Variable Assignment with the SET Statement
20.4.2.Using SET to Assign Variables
20.4.3.Assign the function result to the variable
20.4.4.Return the variable value
20.4.5.Use set command to update a variable
20.4.6.Concatenating Variables
20.4.7.SET variable and column in one command