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

What are horizontal and vertical scaling?

146


What is a data source file?

505


Explain the use of containers in ssis?

536


What is scd (slowly changing dimension)? : sql server analysis services, ssas

600


Is there any difference between primary key and unique with the not null condition?

533






What is merge?

576


can a table be moved to different filegroup? : Sql server administration

553


Explain time data type in sal server 2008?

554


What is save transaction and save point?

630


When to use null data driven subscription?

148


How to list all field names in the result set using mssql_field_name()?

530


List out the different types of locks available in sql server?

562


What is the difference between clustered index and primary key?

508


What does the on delete cascade option do?

563


What is inline variable assignment?

611