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 single-user mode?
What are the different types of replication are there in sql server 2000?
You are designing a strategy for synchronizing an SQL Azure database and multiple remote Microsoft SQL Server 2008 databases. The SQL Azure database contains many tables that have circular foreign key relationships?
What is an execution plan? When would you use it?
What do we need queues in sql service broker?
How to truncate the log in sql server 2012? : sql server database administration
What is sql injection and why is it a problem? : sql server security
Determine how to use the inserted and deleted pseudo tables?
What is correlated subquery in sql server?
Can sql servers link to other servers?
What is the difference between sql server 2000 object owner and sql server 2005 schema? : sql server database administration
How to copy the tables, schema and views from one sql server to another?
Does sql server 2000 full-text search support clustering?
Mention what are the different types of ssrs reports?
Mention the differences between local and global temporary tables.