difference between function and procedure
Answer Posted / manub22
- Stored Procedures can contain a single SQL statement or a group of SQL statements with data flow control logic containing IF-ELSE, WHILE loop constructs, TRY-CATCH, transactions, etc.
SPs are used to return one or many result-sets to its calling application.
- On the other hand Functions or UDFs can contain single or multiple SQL statements depending on its type. A Scalar UDF & Inline UDF can only have a single SELECT statement. And a Multi-Statement UDF can contain a body with multiple SQL statements including SELECTS, IF-ELSE, WHILE loops and DMLs but limited to manipulating table variables only.
UDFs return a single Scalar value or a Table variable to the calling SELECT statement.
Check all the difference here:
http://sqlwithmanoj.com/2011/09/21/stored-procedures-vs-functions-difference-between-sp-udf/
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What are the different types of subquery?
How connect excel to sql server?
List some of the rules that apply to creating and using a ‘view’
How to add code to the existing article (using improve article)?
Can we add a cpu to sql server?
Can we run Reporting Services with SQL Server express edition, which is a free version of SQL Server?
What are indexes in sql?
What are the differences between left join and inner join in sql server?
List the different index configurations possible for a table?
Does group by sort data?
What is the difference between char, varchar and nvarchar?
How you would rewrite the sql query to return the customerid sorted numerically?
What is SQL Azure Data sync?
Write a program using SQL queries to find a unique entry in a table.
What are the advantages of policy management?