title: Why do we need SQL functions when stored procedures can do all what SQL function does?
body: <p>Please don't specify the differences between stored procedure and functions. Just want the reasons where functions have an advantage over stored procedures.</p>
  
  <p>My understanding is that stored procedures works faster than functions and it can do all that a function can do so why do we need function in place?</p>
  
  <p>I have read articles where it states that it can easily embedded in an select statement but that can be done in stored procedure as well (by writing the whole select statement in the stored procedure).</p>