Sunday, 27 September 2015

Difference between Store Procedure and User defined Function

Below list is major difference between Store Procedure and User defined Function in Sql Server;



Store Procedure
User Defined Function
DML Statement
Store procedure supports the DML operations. 
Like Insert update and Delete.
Its not support DML statements.
Return
Store procedure may or may not return the value
Function must return a value.
Transaction
Transactions allows in Store procedure.
Transactions not allow in user defined functions.
Call by Store Procedure
 Store Procedure can call other store procedure and function.
Function cannot call store procedure.
Call from select Statement
Procedures can’t be called from Select statement.
Function can be called from select statement.
Parameters
It Support both input and output Parameters.
It support input but not supports the output parameters.
Exception Handling
Its allow try and catch.
Its not allow try and catch.
Temporary Table
Its allow Temporary table.
Its not allow Temporary table.

No comments:

Post a Comment

Others

You will like to read it