SQL Server Interview Questions and Answers
<< Previous Question Next Question >>
 Question: 465 Page Views: 

Differentiate between Function and Stored Procedure?



Posted By: Avi Date: 1 October 2010 11:15:07 AM
 Answer:

1. Function returns a value but it is not necessary that stored procedure return a value. 2. Function can return only single value but sored procedure can return multiple values. 3. Function can be called using SQL statements i.e insert,update,delete. Where as stored procedure can be called directly using exec keyword. 4. Both function and stored procedure can have DDL,DML,TCL inside them . 5. Function has no capability of calling a function whereas stored procedure can call a function. 6. Functions can not handle transaction related statements whereas procedures can handle them Efficiently.


Posted By: avibtech


Date: 1 October 2010 11:15:07 AM
Post a better Answer if you have
 
(Will show your Gravatar icon)  
  Country flag

Loading
Enter the text as shown in the image AQEX5h
Related Questions
SQL Server : Does the order of columns matter while creating a table? i.e which coulms should come first and which last according to constraints and values?
SQL Server : Having the following table:- 
sno          val1
1              7.5
2              8
3              9.5
4              11
.
.
.
N              val
Write the code to update the table where the difference in the column "val1" is computed i.e. (val1[2]-val1[1

Having the following table:- sno val1 1 7.5 2 8 3 9....

Code Required is:- update cal set diff_val = 0 where ID = (select min(sno) from cal) Update cal ....
Category: SQL Server Date: 10/1/2010 11:16:07 AM
SQL Server : Differentiate between Function and Stored Procedure?

Differentiate between Function and Stored Procedure?

1. Function returns a value but it is not necessary that stored procedure return a value. 2. Functio....
Category: SQL Server Date: 10/1/2010 11:15:07 AM
SQL Server : What is the purpose of the locks in SQL Server?

What is the purpose of the locks in SQL Server?

Category: SQL Server Date: 10/1/2010 11:12:07 AM
SQL Server : Usually clustered and non-clustered indexes are discussed. It can be further configured into three categories. Which are those?

Usually clustered and non-clustered indexes are discussed. It can be further configured into three c....

The three ways other than clustered and non-clustered it can be configured into Composite Index and ....
Category: SQL Server Date: 10/1/2010 11:11:07 AM