Friday, April 8, 2011

Difference between stored procedure and function



Stored Procedure
Function
Cannot be used in the select statement

Can be used within a select to return a single value or to use a set of rowset from the function.
Can use transaction
Cannot use transaction
Cannot be used in join
Can be used in join
Have to use exec to execute the query
Need to use select to execute
Can return only integer value
Can return scalar value - table rows
Uses precompiled execution plan to 
execute the stored procedure 
Doesnot uses it.

No comments:

Post a Comment