Difference between stored procedure and function in sql server
- Function must return a value whereas Stored Procedure it is optional.
- Functions can have only input parameters for it whereas Procedures can have input/output parameters.
- Function takes one input parameter it is mandatory but Stored Procedure may take o to n input parameters.
- Functions can be called from Procedure whereas Procedures cannot be called from Function.
- Procedure allows SELECT/INSERT/UPDATE/DELETE statement in it whereas Function allows only SELECT statement in it.
- We can go for Transaction Management in Procedure whereas we can't go in Function.