What is the difference between stored procedure vs function?



What is the difference between stored procedure vs function?..

Answer / Diksa Kapoor

Both Stored Procedures and Functions are database objects in SQL Server, but they have some key differences:

1. Purpose: Stored Procedures are used to perform a series of tasks or operations within the database, while Functions are used to return a single value from an expression based on input parameters.

2. Execution: A stored procedure is executed with the EXECUTE command, whereas a function is called like any other SQL statement using its name and passing input parameters if required.

3. Output: Stored Procedures do not have an output, while functions return a value that can be used in queries or assignments within SQL.

4. Example: A stored procedure might perform a complex data manipulation task like updating multiple related records, whereas a function could calculate a user's total purchases for a given period.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More ASP.NET Interview Questions

What is State Management in .Net and how many ways are there to maintain a state in .Net?

6 Answers  


Describe how to implement globalization and localization in the use interface in .net.

1 Answers  


What tags do you need to add within the asp:datagrid tags to bind columns manually

2 Answers  


Where sessions are stored in asp.net?

1 Answers  


Explain About WebService

1 Answers   BirlaSoft,


What r the asp.net list controls and diff. Between them?

1 Answers  


What is the use of sessionstate tag in the web.config file?

2 Answers  


What are the event handlers that can be included in the Global.asax file?

1 Answers   MindCracker,


Which adapter should you use, if you want to get the data from an access database?

1 Answers  


What’s the use of “GLOBAL.ASAX” file?

1 Answers  


How to set/get parent page values in child page in asp.net

3 Answers   Wipro,


how can you handle "control is not part of this page " error?

3 Answers   FactorH,


Categories