---
title: "Difference between stored procedure and function?"  
description: "Difference between stored procedure and function?"  
author: "Anoop Singh"  
published: 2010-10-11  
updated: 2010-10-11  
canonical: https://www.mindstick.com/forum/33/difference-between-stored-procedure-and-function  
category: "mssql server"  
tags: ["mssql server"]  
reading_time: 2 minutes  

---

# Difference between stored procedure and function?

[Difference](https://www.mindstick.com/articles/157114/good-news-or-bad-news-and-the-difference-is) between [stored procedure](https://www.mindstick.com/articles/803/using-stored-procedure-in-asp-dot-net) and [function](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server)?\
\
![Difference between stored procedure and function?](http://www.mindstick.com/App_Images/HTMLEditor.icons/eusa_wall.gif) [Please explain](https://www.mindstick.com/forum/344/hi-rohith-i-am-new-for-mvc-please-explain-how-to-set-implicitly-isauthenticated-true)!!!\
\
Thanks \

## Replies

### Reply by Anonymous User

Hi Anoop,\
\

**Difference between Function and Stored [Procedure](https://www.mindstick.com/forum/32/stored-procedure-return-datatype)**

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/\
\
\

### Reply by Uttam Misra

Both functions and [stored](https://www.mindstick.com/forum/157561/what-is-the-stored-procedure-create-a-procedure-to-find-the-record-by-stu_id-from-the-student-table) 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!! ![Difference between stored procedure and function?](https://www.mindstick.com/app_images/htmleditor.icons/msp_thumbup.gif)\


---

Original Source: https://www.mindstick.com/forum/33/difference-between-stored-procedure-and-function

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
