What is the difference between Stored Procedure (SP) and User Defined Function (UDF)?
Some of major differences between a stored procedure and user defined are as follows:-
1. The UDF can be executed by using the "SELECT" clause while SP's can not be.
2. The UDF cannot be used in the XML FOR clause while the SP's can be used.
3. The UDF does not return any output parameters while the SP's return output parameters.
4. If there is an error in the UDF its stops executing. But in SP's it just ignores the error and moves to the next statement.
5. The UDF cannot make permanent changes to the server environments while SP's can
6. Change some of the server environment.