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

What is the purpose of App_Code folder in ASP.NET? Why we this?

607


How can we access static variable?

645


What is class and object in asp.net?

490


List the types of authentication supported by asp.net?

523


What are the advantages of the code-behind feature?

533






Is it possible to write code in many languages in one asp.net project?

555


How long should a session id be?

522


What is the difference between executescalar and executenonquery?

508


What are asp.net web forms?

517


Explain asp.net page life cycle?

609


Disable Mouse right click on web page in asp.net?

579


Can you change a Master Page dynamically at runtime?

574


What is a global postback url?

511


explain code with multi inhertance

1646


What is viewstate information stored?

598