Assign the function result to the variable : Set « Transact SQL « SQL Server / T-SQL Tutorial






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








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