title: SQL Server equivalent to Oracle LEAST?
body: <p>I've been looking for a good equivalent to the Oracle LEAST function.</p>
  
  <p>I'm hoping to implement a user defined function that does about 10 fairly complex calculations, and takes the minimum value from each of those calculations.</p>
  
  <p>What I would do in Oracle is: </p>
  
  <pre><code>SELECT LEAST
  (
  select expression1 from dual,
  select expression2 from dual,
  select expression3 from dual
  ) from dual
  </code></pre>
  
  <p>See <a href="http://www.techonthenet.com/oracle/functions/least.php" rel="nofollow noreferrer">http://www.techonthenet.com/oracle/functions/least.php</a> for more on Oracle LEAST.</p>
  
  <p>If expression1 returned 10, expression2 return 5, and expression3 reeturned 30, the whole expression would return 5.</p>
  
  <p>Because this may be about 10-20 calculations, the CASE WHEN syntax is going to get unwieldy fast.</p>
  
  <p>Although the code will be more readable if we break it up more, I thought it would be more efficient to do it within one database query. Let me know I'm incorrect on that point, please!</p>
  
  <p>I.e., is a stored procedure with 20 simple queries significantly slower than a stored procedure with one query that references a lot of tables all in one query.</p>