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 different types of views?
Can a trigger be created on a view?
what are database files and filegroups? : Sql server database administration
What is indexing explain it with an example?
How do you rename a table in sql server?
What are the properties of the transactions?
How do I uninstall sql server 2014?
What are indexers?
What is an indice?
What are the advantages of sql azure?
What is full outer join in sql server joins?
How to modify existing triggers using "alter trigger"?
What is a join in sql? What are the types of joins?
List some major differences between triggers and stored procedures?
You have to store user responses of ‘yes’ and ‘no’ what kind of data type is best suited for this task?