What are the differences between stored procedure and
functions in SQL Server 2000?

Answer Posted / bed singh

a. A FUNCTION is always returns a value using the return
statement. A PROCEDURE may return one or more values
through parameters or may not return at all.
b. Functions are normally used for computations where as
procedures are normally used for executing business logic.
c. A Function returns 1 value only. Procedure can return
multiple values (max 1024).
d. Stored procedure returns always integer value by default
zero. Whereas function returns type could be scalar or
table or table values
e. Stored procedure is precompiled execution plan where as
functions are not.
f. A function can call directly by SQL statement like
select func_name from dual while procedure cannot.
g.Stored procedure has the security and reduces the network
traffic and also we can call stored procedure in any no. of
applications at a time.
h. A Function can be used in the SQL Queries while a
procedure cannot be used in SQL queries .that cause a major
difference b/w function and procedures.

Is This Answer Correct ?    165 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is the main function of a query parameter?

111


Retrieve the unique rows from table without using UNIQUE and DISTINCT keywords.

593


What is SQL Azure Data sync?

105


What are the different types of join?

573


explain different levels of normalization? : Sql server database administration

524






Explain how does the report manager work in ssrs?

501


What is scan table/view and seek table/view when its occurs? : sql server database administration

539


What according to you is the difference between mysql and sql server performance?

563


What is the difference between executequery () and executeupdate ()?

518


Explain error and transaction handling in sql server?

504


what is dbcc? : Sql server database administration

529


Which sql server table is used to hold the stored procedure script?

479


Explain where clause?

537


What is side by side migration in sql server?

541


What does set rowcount do?

516