What is difference between stored procedure & function?

Answer Posted / khurram

1>Procedure can return zero or n values whereas function can
return one value which is mandatory.

2>Procedures can have input,output parameters for it whereas
functions can have only input parameters.

3>Procedure allow select as well as DML statement in it
whereas function allow only select statement in it.

4>Functions can be called from procedure whereas procedures
cannot be called from function.

5>Exception can be handled by try-catch block in a procedure
whereas try-catch block cannot be used in a function.

6>We can go for transaction management in procedure whereas
we can't go in function.

7>Procedures cannot be utilized in a select statement
whereas function can be embedded in a select statement.

Is This Answer Correct ?    17 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to use go command in "sqlcmd"?

652


What are scalar functions in sql?

617


Why main is user defined function?

573


What is a matrix in ssrs?

101


How many replicas are maintained for each SQL Azure database?

128






How to how to convert numeric expression data types using the convert() function??

555


Explain time data type in sal server 2008?

554


What is difference between sql and sql server?

550


What is an execution plan? When would you use it?

587


What is rtm version in sql server?

534


What is the index requirement in SQL Azure?

72


what is the difference between a primary key and a unique key? : Sql server database administration

535


What is the difference between ROW_NUMBER and Ranking function in SQL SERVER?

612


what is the difference between Delete and Truncate command in SQL

632


What is SQL Azure Firewall?

116