What is difference between stored procedure & function?

Answer Posted / somu kattikar

Functions
----------
1) can be used with Select statement
2) Not returning output parameter but returns Table
variables
3) You can join UDF
4) Cannot be used to change server configuration
5) Cannot be used with XML FOR clause
6) Cannot have transaction within function

Stored Procedure
-----------------
1) have to use EXEC or EXECUTE
2) return output parameter
3) can create table but won’t return Table Variables
4) you can not join SP
5) can be used to change server configuration
6) can be used with XML FOR Clause
7) can have transaction within SP

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the different types of triggers in SQL SERVER?

541


Explain “@@rowcount” and “@@error” in sql server?

541


How do I get Report Builder to generate a parameter that can be set by users viewing the report?

100


Explain table valued parameters in sql server? Why tvp used?

561


What happens if an integer is too big for int date type?

581






What are the different types of stored procedures?

556


What are the types of normalization?

556


What do you need to connect php to sql server?

545


How to get all stored procedures in sql server?

510


Do you know what are acid properties of transaction?

526


difference between Clustered index and non clustered index ?

581


What are the advantages of using a stored procedure?

562


How will you optimize a stored procedure optimization?

517


What is a fill factor?

627


You want to implement the one-to-many relationship while designing tables. How would you do it?

513