Differences between functions and stored procedures?

Answer Posted / paras

UDF
1. Must return a value – a single result set
2. Directly used in select, order by,where, from
3. UDF can’t use nondeterministic function Such as
getdate(), rand()
4. Can’t change server enviroment variables
5. Stops execution of T-SQL code when error occurs
6. Can’t use temp table in UDF

Stored Procedure
1. Can return value – multiple result set
2. Can’t use in select
3. Can use nondeterministic functions
4. Can change server enviroment variables
5. Stored procedure move to the next instruction if you used
proper error handling,
6. Can use temp table in SP

Is This Answer Correct ?    6 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what is row_number function?

560


What is the recovery model? List the types of recovery model available in sql server?

487


Can group functions be used in the order by clause in ms sql server?

588


Explain the difference between HTTP and HTTPS in database?

562


How to maintain a fill factor in existing indexes?

530






What is the use of keyword with encryption. Create a store procedure with encryption?

584


Tell me the difference between clustered and non-clustered index?

515


What are the different methods available under sqlcommand class to access the data?

689


Can you explain different types of locks in sql server?

525


Explain transaction server explicit transaction?

507


What is full outer join in sql server joins?

571


Do you know query execution plan?

588


How will you optimize a stored procedure optimization?

517


Explain transaction server isolation?

545


explain different types of backups avaialabe in sql server? Given a particular scenario, how would you go about choosing a backup plan? : Sql server database administration

589