What is the difference between a Stored procedure and function?

Answer Posted / viren chakraborty

a stored procedure is better when returning one or more
rows.
a function is better when returning a single scalar value.
function and procedure, both can accept parameters and both
also support output parameters.
for programmers, stored procedures are the way to go
because they directly return the result of a given select
statment.
in a function you will explicitly have to return a value
using return statement and returning more than 1 value
using a function is much more complicated.
the procedure is capable of doing all kinds of things
(select/insert/update/delete) and hence, it is better

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Name the tools or API for developing or testing web api?

713


Define application state variable and session state variable?

761


What is full form of asp.net?

699


What is the difference between globalization and localization?

662


How can we create a website?

709


How to disable cut, copy and paste in TextBox using jQuery in asp.net?

854


Is there any alternative to avoid name collisions other then Namespaces?

792


What is a postback in asp net?

779


What do you mean by serialize and marshalbyref?

754


What is globalization and localization in asp net?

684


What is special types forms

730


How does session work in asp net?

743


What is viewstate? What does the "enableviewstate” property do? Whay would I want it on or off?

688


What are server objects?

694


What can you do with asp.net?

679