adspace


What is the difference between stored procedure vs function?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you mean by query string?

1011


hi .net gurus. plz if any one has dumps on 70-631 and 70-541 on windows sharepoint services kindly mail me.

1714


a web application needs to be created to accept the product name and quantity of a toy from a customer. After the customer has entered the product name the application needs to display the discounted price of the product to the customer (company is offering 35% discount on all products). The application should allow the customer to select the product name from a list box. and also while i'm data binding to a label with custom data binding with some declarations : "The Discounted Price is "+((System.Convert.todouble(lblprodprice.text)*(system.convert.todouble(txtqty.text)) - ((System.convert.todouble(lblprodprice.text)*(system.convert.todouble(txtqty.text)*0.35)). Where i need to give this declaration in asp.net 2.0.

1890