What is difference between stored procedure and function?

Answer Posted / a.suresh

1.Stored Procedure return 0 to nth value where as function
return only one value which is must.
2.we can't use the stored procedure in select select
statement where as function can be used in the select statement.
3.we can use all the dml(insert,update,delete) commands in
stored procedure where as select statement only used in
functions.
4.we can use try catch in stored procedure where as in
functions cant.
function must be used with its schema where as stored
procedure used with out schema name
ex.dbo.function name

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is data source document?

541


How to insert data with null values?

580


Scalability, Availability, Integration with internet, etc.)?

2427


What is the boxing and unboxing concept in .net?

538


What is change data capture (cdc) in sql server 2008?

559






What is the difference between varchar and nvarchar datatypes?

569


How to see the event list of an existing trigger using sys.trigger_events?

564


Can primary key be a foreign key?

553


Can we perform backup restore operation on tempdb? : sql server database administration

582


Tell me what do we need queues in sql service broker?

511


What is the difference between MVC and Teir Architecher? Plz explain with Layyered Programming example...? Thanks

1607


Other than truncate statement, which other command can by-pass the trigger on the tables?

613


How efficient you are in oracle and SQL server?

630


Write a sql query to sort on different column name according to the parameters passed in the function?

522


Please explain what is “asynchronous” communication in sql server service broker?

505