Sponsored By
MindStick SurveyManager
Advertise with Us
Advertisement
Advertise with Us
Follow Us
Follow _MindStick_ on Twitter View MindStick Software's LinkedIn profile View MindStick Software's Facebook profile
Mindstick
Article Article  Forum Forum  Blog Blog  Quiz Quiz  Beginner Beginner  Careers Careers  Contact Contact  Login Login  
Home | Product | Services | About Us | Interview | DeveloperSection | Submit an Article | Submit Blog
Report Abuse Form
Reason:    
   

Home >> Database >> MSSQL Server 2000/2005/2008/2012 >> Difference between stored procedure and function?
Author Post

Anoop Singh


Total Post: 12
Member Since: 10/8/2010
Points: 62
Difference between stored procedure and function?
Posted On: 10/11/2010 7:37:08 AM
Difference between stored procedure and function?

  Please explain!!!

Thanks
Modified On: 10/11/2010 7:37:53 AM
Author Post

Uttam Misra


Total Post: 113
Member Since: 6/2/2010
Points: 818
Re: Difference between stored procedure and function?
Posted On: 10/11/2010 8:10:58 AM
Both functions and stored procedures are sequence of SQL statements stored in the database for future access Difference between them is that:
Procedures are compiled. They are stored in compiled format in the database
Functions are compiled and excuted runtime.

Cheers!!
Author Post

Haider M Rizvi


Total Post: 40
Member Since: 6/6/2010
Points: 291
Re: Difference between stored procedure and function?
Posted On: 10/11/2010 8:15:31 AM
Hi Anoop,

Difference between Function and Stored Procedure

1. A function is a subprogram written to perform certain computations and return a single value. 

2. Functions must return a value (using the RETURN keyword), but for stored procedures this is not compulsory.

3. Stored procedures can use RETURN keyword but without any value being passed. 

4. Functions could be used in SELECT statements, provided they don’t do any data manipulation. However, procedures cannot be included in SELECT statements. 

5. A function can have only IN parameters, while stored procedures may have OUT or INOUT parameters. 

6. A stored procedure can return multiple values using the OUT parameter or return no value at all.

For more details about Stored Procedure you can click on the link below, where I have explained more about Stored procedure.

http://www.mindstick.com/Articles/3db9ca2c-0a41-4f7a-9ce9-82f743563737/


Modified On: 10/11/2010 8:29:39 AM
Report Abuse Form
Reason:    
 
Total Online Users: 3001
Advertisement
MindStick DataConverter
Advertise with Us
  
Copyright © 2009 - 2013MindStick. All Rights Reserved.