Using SET to Assign Variables
1>
2> -- Using SET to Assign Variables
3>
4> -- Capture the return value for the same function.
5>
6> DECLARE @MyNumber Int, @MyResult Int
7> SET @MyNumber = 144
8>
9> -- Assign the function result to the variable:
10> SET @MyResult = SQRT(@MyNumber)
11> -- Return the variable value
12> SELECT @MyResult
13> GO
-----------
12
(1 rows affected)
1>
Related examples in the same category