1
We can use UDF in SP but we can not use SP in UDF
1
<strong>Function</strong> must return a value but in <strong>Stored Procedure</strong> it is optional( <strong>Procedure</strong> can return zero or n values). <strong>Functions</strong> can have only input parameters for it whereas <strong>Procedures</strong> can have input/output parameters . <strong>Functions</strong> can be called from <strong>Procedure</strong> whereas <strong>Procedures</strong> cannot be called from <strong>Function</strong>.
1
Hi Hariharan,
In store procedure you can insert,update,delete data but in function only select data.
this is a main difference between store procedure and function.
0
From the tone of the question, it is not clear if you genuinely asking the question or just testing our knowledge. Anyway!
Apart from the TWO major differences mentioned already, another major difference is you cannot use output returned from sp in a join but can use returned from user defined TVF.
Furthermore you only mention UDF but don't differentiate between Scalar function and TVF.
0
Stored Procedure can return multiple result sets while Function can only return single result set which means that in Stored procedure you can have multiple select statements while in Function you cannot have that.