Today
i am going to explain difference between SP and UDF which is most common
interview question.
Stored
Procedure (SP)
|
Function (UDF
– User Defined Function)
|
SP can return zero , single or multiple
values.
|
Function can return one value which is
mandatory.
|
We can use transaction in SP.
|
We can’t use transaction in UDF.
|
SP can have input/output parameter.
|
Only input parameter.
|
We can called function from SP.
|
We can’t call SP from function.
|
We can’t use SP in SELECT/ WHERE/ HAVING
statement.
|
We can use UDF in SELECT/ WHERE/ HAVING
statement.
|
We can use exception handling using
Try-Catch block in SP.
|
We can’t use Try-Catch block in UDF.
|
No comments:
Post a Comment