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 is b tree index?
How is sql used in sql server?
What is the name of reporting services config file and what’s it’s used for?
What are some examples of schemas?
How many non clustered indexes there can be on table ?
Explain concepts of analysis services?
Can we use trigger new in before insert?
Explain the phases a transaction has to undergo?
What are the restraints imposed on the table design by a merge replication?
What is it’s similarity with sql server?
How to delete duplicate rows from table except one?
How to maintain a fill factor in existing indexes?
What are difference between Cluster index and Non-Cluster index?
Insert syudents details in table.Current system date &time insert into joining time.How do insert?( in sysdate only return current system date how do add time?)
What are rows and columns?