Difference between Stored Procedure and Function in SQL Server

  • Function must return a value but in Stored Procedure it is optional
  • Functions can have only input parameters for it whereas Procedures can have input/output parameters
  • Functions can be called from Procedure whereas Procedures cannot be called from Function
  • Procedure allows SELECT as well as DML(INSERT/UPDATE/DELETE) statement in it whereas Function allows only SELECT statement in it.
  • Procedures can not be utilized in a SELECT statement whereas Function can be embedded in a SELECT statement.
  • We can go for Transaction Management in Procedure whereas we can't go in Function.

results matching ""

    No results matching ""