title: SQL Server Set Value of Select Max or Sum Into Variable
body: <p>I try to make a stored procedure on SQL Server but when I set the select results into one variable it returns NULL.</p>
  
  <p>example:</p>
  
  <pre><code>set @myvar= select Sum(Values) from myTable
  </code></pre>
  
  <p>but when I make a select without a function, the variable returns the expected value. </p>