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
What is normalization 1nf 2nf 3nf?
What is replication with database mirroring? : sql server database administration
is it important for a database administrator to understand the operating system and file access? : Sql server administration
What does it mean to normalize a database and why would you do it?
What is bit data type? What's the information that can be stored inside a bit column?
What will be the value of @@fetch_status if a row that was a part of the cursor resultset has been deleted from the database after the time the stored procedure that opened the cursor was executed?
How do I view a procedure in sql server?
Is sql server a database?
What are the tools available in market as an alternative to sql server reporting services?
What is the difference between an index and a unique index?
What is it unwise to create wide clustered index keys?
Can you please explain the difference between function and stored procedure?
Is profiler the only tool that has the ability to audit and identify ddl events? : sql server security
What are the differences between DDL, DML and DCL in SQL?
Mention the differences between local and global temporary tables.