---
title: "Difference between Store Procedure and UDF User Define Function"  
description: "In this blog I am trying to differentiates between Store Procedure and UDF User Define Function:Store Procedure:1.Stored procedure may or not return v"  
author: "Vijay Shukla"  
published: 2012-12-31  
updated: 2014-09-18  
canonical: https://www.mindstick.com/blog/420/difference-between-store-procedure-and-udf-user-define-function  
category: "database"  
tags: ["database"]  
reading_time: 2 minutes  

---

# Difference between Store Procedure and UDF User Define Function

In this blog I am trying to differentiates between [Store Procedure](https://www.mindstick.com/forum/193/auto-increment-by-store-procedure) and UDF User Define Function:

##### Store Procedure:

1. [Stored procedure](https://www.mindstick.com/articles/803/using-stored-procedure-in-asp-dot-net) may or not return values.

2. It will allow DQL select statements [as well as](https://www.mindstick.com/interview/2481/can-you-write-a-java-class-that-could-be-used-both-as-an-applet-as-well-as-an-application) DML statements such as insert, update, delete etc.

3. [Stored procedures](https://www.mindstick.com/forum/540/using-stored-procedures-with-entity-framework-in-an-asp-dot-net-application) have mutually [input and output](https://www.mindstick.com/forum/161309/what-are-the-features-of-the-console-class-for-input-and-output-in-java) parameters.

4. We can use try and catch blocks for [exception handling](https://www.mindstick.com/articles/12240/introduction-of-exception-handling) in stored procedures.

5. Stored procedure can use transactions inside stored procedures.

6. Stored procedure can use both [table variables](https://www.mindstick.com/forum/161555/what-are-the-key-differences-between-temporary-tables-and-table-variables) as well as [temporary table](https://www.mindstick.com/articles/12546/temporary-table-in-sql) in it.

7. Stored Procedures be able to call functions.

8. Procedures can’t be called from Select/Where/Having etc statements. Execute/Exec statement can be used to call/execute stored procedure.

9. Store procedures can’t be used in Join clause.

\
UDF User Define Function:

1. Function necessities return a value.

2. UDF will allow only [Select statement](https://www.mindstick.com/forum/160076/explain-the-sql-select-statement-and-how-it-s-used-to-search-for-data-in-a-database); it will not allow us to use DML statements.

3. UDF will allow only input parameters, doesn’t support output parameters.

4. UDF will not allow us to use try-catch blocks.

5. UDF transactions are not allowed within functions.

6. We can use only table variables; UDF will not allow using [temporary tables](https://www.mindstick.com/blog/11216/temporary-tables-magic-table-and-injection-in-sql).

7. Stored procedures can’t be called from function.

8. Functions can be called from select statement.

9. UDF can be used in join clause as a result set.

---

Original Source: https://www.mindstick.com/blog/420/difference-between-store-procedure-and-udf-user-define-function

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
