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 b tree index?

522


What is attribute relationships, why we need it? : sql server analysis services, ssas

510


What are user-defined functions (udfs) in sql server?

578


What is the difference between a stored procedure and a user defined function?

552


Other than truncate statement, which other command can by-pass the trigger on the tables?

624






what is a join? : Sql server database administration

553


Do you know clustered and non-clustered index?

533


What is sleeping status in sql server?

530


What do you mean by table and field in sql?

562


What is the most common type of join?

536


How you can move data or databases between servers and databases in sql server?

574


How do you delete duplicate rows in sql server?

512


What is sql server management studio? : sql server management studio

593


How to assign new column names in a view?

509


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

541