Difference between Stored Procedure and Functions
what is most important difference Stored procedure and Functions?
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Pravin MoreRank #1,419 · 1.2K reputationPosted Sep 29, 2011, 8:28 PM EDT
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 ShaikhRank #839 · 2.7K reputationPosted Sep 29, 2011, 8:15 PM EDT
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.