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
where can you add custom error messages to sql server? : Sql server administration
What are the differences between lost updates and uncommitted dependencies?
What is a bit datatype?
What are different types of data sources?
What are the new features introduced in SQL Server 2000 (or the latest release of SQL Server at the time of your interview)? What changed between the previous version of SQL Server and the current version?
Characterize join and name diverse sorts of joins?
What is the purpose of forms?
What is the importance of concurrency control?
What are the underflow and overflow behaviors on float literals?
Does sql server use t sql?
How to delete an existing row with delete statements in ms sql server?
What is normalization of database?
What is the simplest way to create a new database in ms sql server?
What is the difference between grant and with grant while giving permissions to the user?
What are cascading parameters in ssrs reports?