Thursday, 24 November 2016

Differences between Stored Procedure and Functions

Very frequent question asked in interview is Differences between Stored Procedure and Functions.
Below are the differences between these 2.

1) Functions must return a value. Stored procedure need not be.
2) Stored procedures can be called using EXEC command where as Functions can be called from another SQL Statement.
3) Stored Procedures are precompiled. Functions are not precompiled.
4) Generally Stored procedures are used for executing business logic where as Functions are used to execute computations .
5) Functions can return only one value at a time where as stored procedures can return more than one value at a time.

6) Functions cannot return Images and text.Stored procedures can return all types of datatypes.

No comments:

Post a Comment

Dear Readers, Please post your valuable feedback in the comment section if you like this blog or if you have any suggestions. I would love to hear the same from you. Thanks