Sr. | Stored Procedure (SP) | Function |
1 | SP have both input and output parameters | Function only have input parameters |
2 | SP return 0 or n values | Function return only 1 value that is mandatory |
3 | SP can’t be called from a function | Function can be called from a procedure. |
4 | Inside a procedure we can use DML (INSERT/UPDATE/DELETE) statements | Inside a function we can’t use DML statements |
5 | SP can’t be used in a Select statement | Function can be used in a select statements |
6 | SP can’t be used anywhere in the WHERE/HAVING/SELECT section in SQL | Function can be used in WHERE/HAVING/SELECT section in SQL statements |
7 | SP can include or use TRY CATCH block | Function can’t use TRY CATCH bock |
8 | SP can use transaction management | Function can’t use transaction management |
9 | We can’t join Stored Procedures | We can join Functions |