What is the difference between Userdefined function and
stored procedure? Explain and give the example also

Answer Posted / ashwini

1. User defined functions can be used in select statements.
Procedures can not be used.

2. Functions must return some value. Procedures do not
always return the value.

3. Functions will take only input parameters. Procedures
can take input as well as output parameters.

4. Not all types of user-defined functions use
INSERT,UPDATE,DELETE statements(Only multi-statement table
valued functions can use). All procedures can use these
statements.

Is This Answer Correct ?    6 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the new security features added in sql server 2012? : sql server security

540


What do you know about normalization and de- normalization?

473


what is database replicaion? What are the different types of replication you can set up in sql server? : Sql server database administration

540


What is the default value of an integer data type in sql server 2005?

590


How to get a list of columns in a view using the "sp_help" stored procedure?

586






You have a table with close to 100 million records recently, a huge amount of this data was updated now, various queries against this table have slowed down considerably what is the quickest option to remedy the situation?

493


Insert syudents details in table.Current system date &time insert into joining time.How do insert?( in sysdate only return current system date how do add time?)

1440


How to delete existing triggers using "drop trigger"?

572


What are the events recorded in a transaction log?

514


What is blocking?

574


explain different types of cursors? : Sql server database administration

569


Tell me what is the order in which the sql query is executed?

538


How to get the definition of a stored procedure back?

534


Is truncate autocommit?

570


What are the properties of primary key?

525