Differnce between Stored procedure and user defined functions?
Answer Posted / santosh kumar
Sl. No. User Defined function Stored Procedure
1 Function must return a value. Stored procedure may or not return values.
2 Will allow only Select statement, it will not allow us to use DML statements. Can have select statements as well as DML statements such as insert, update, delete
etc
3 It will allow only input parameters, doesn’t support output parameters. It can have both input and output parameters.
4 It will not allow us to use try-catch blocks. For exception handling we can use try catch blocks.
5 Transactions are not allowed within functions. Can use transactions within Stored procefures.
6 We can use only table variables, it will not allow using temporary tables. Can use both table variables aswell as temporary table in it.
7 Stored procedures can’t be called from function. Stored Procedures can call functions.
8 Functions can be called from select statement. Procedures can’t be called from Select/Where/Having etc statements. Execute/Exec
statement can be used to call/execute stored procedure.
9 UDF can be used in join clause as a result set. Procedures can’t be used in Join clause
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Explain the basic use of "dataview" and explain its methods.
What do you know about ado.net's methods?
What is the use of SqlCommandBuilder?
What is microsoft ado.net?
The answers which posted above is not satisfied my requirement? Can some one post teh exact answer? Thanx
What is openquery?
What is dataset and datatable in ado.net?
What do you know about ado.net's objects?
What is disconnected architecture in ado.net?
What is the use of ADO.NET and XML web services?
Explain why edit is not possible in repeater?
What are the ado.net connection pooling parameters?
What are the benefits of using ado.net?
Name which operations can you not perform on an ado.net dataset?
What are the different namespaces used in the project to connect the database? What data providers available in .net to connect to database?