Difference between Stored Procedure and Functions
what is most important difference Stored procedure and Functions?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Pravin MorePosted Sep 30, 2011, 12:28 AM
I think most important difference is that In Function You cant do Insert,Update,its not allowed in function instead you can do it in sprocs.
*when to use function:-They can only be use to select records. they can be called very easily from within standard SQL,like this .................SELECT dbo.functionname('Parameter1') .
*when to use Sprocs:-we can use to for simple reason like select statement, or as complex reason like long script that adds, deletes, updates, and/or reads data from multiple tables in a database.
In simple language,Comparing with programming concept, Stored Procedure is Like program and function is like method of that program.
Thank You,Hope this info will help you.
Pravin.
Javeed M ShaikhPosted Sep 30, 2011, 12:15 AM
Function must return a value and Stored procedure it is optional
Function can have only IN param, while stored procedure can have IN and OUT
I think Function gets compiled each time on the call and stored procedure compile only once.