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 the types of lock supported by ?

781


Explain magic tables in sql server?

723


Name few endpoints exposed by ssrs 2012?

330


Can a function call a stored procedure in sql server?

698


How we create SQL Server 2005 Reporting Services ? Give me Sample

1738






What are the filtered indexes?

779


What happens to a trigger with multiple affected rows?

691


What are pages and extents? : SQL Server Architecture

710


What is amo? : sql server analysis services, ssas

836


Which autogrowth database setting is good?

790


how to take backup bcp out for a column in table in sql server?

1828


What is nolock hint in sql server 2008

824


What are the elements of dbms?

711


You have several tables, and they are joined together for querying. The tables contain both clustered indexes and non clustered indexes to optimize performance, how should you distribute the tables and their indexes onto different file groups?

743


what is a join? : Sql server database administration

746