The difference between Stored Procedure and Function is one of the most common interview question. In this article you will learn the basic differences between Stored Procedure and Function.
Stored Procedure
  • Stored Procedure may or not return values.
  • Procedures Can have select statements as well as DML statements such as insert, update, delete and so on.
  • Procedures can have both input and output parameters.
  • For exception handling we can use try catch blocks.
  • Can use transactions within Stored Procedures.
  • Procedures Can use both table variables as well as temporary table in it.
  • Stored Procedures can call functions.
  • Procedures can't be called from Select/Where/Having and so on statements. Execute/Exec statement can be used to call/execute Stored Procedure.
  • Procedures can't be used in Join clause.
Function
Please give your valuable suggestions and feedback.