Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / pavan pareta

1) functions are used for computations where as procedures
can be used for performing business logic
2) functions MUST return a value, procedures need not be.
3) you can have DML(insert, update, delete) statements in a
function. But, you cannot call such a function in a SQL
query..eg: suppose, if u have a function that is updating a
table.. you can't call that function in any sql query.-
select myFunction(field) from sometable; will throw error.
4) function parameters are always IN, no OUT is possible

Is This Answer Correct ?    145 Yes 43 No

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

Answer / vampire007

1. Functions can be used inline with a select statement
while sprocs can't.

2. EXEC command can't be used inside a Function where it
can be used inside an sproc.

Is This Answer Correct ?    75 Yes 23 No

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

Answer / vijayabhaskarreddy

there are 3 main differences between sp and function.
1 sp takes input,output parameters, function takes only
input parameters.
2 temparary variables required to store return values of
sp. in functions temparary variables will be optinale.
3 sp can not be called directly into DML statements ,
functions can be called directly into DML statements.

Is This Answer Correct ?    64 Yes 19 No

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

Answer / pss

Function return only one value where as procedure can more
than

Is This Answer Correct ?    58 Yes 14 No

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

Answer / ugandhar

Stored procedure have the security and reduce the network
traffic.
and also we can call stored procedure in any no.of
applications at a time.

Is This Answer Correct ?    46 Yes 12 No

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

Answer / srinivas

Stored procedures are a set of actions already written and
stored inside the database for acheiving a particular task
where as functions are general database objects which are
used for general purpose programming

Is This Answer Correct ?    46 Yes 27 No

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

Answer / prashant

1>Procedure can return zero or n values whereas function can
return one value which is mandatory.

2>Procedures can have input,output parameters for it whereas
functions can have only input parameters.

3>Procedure allow select as well as DML statement in it
whereas function allow only select statement in it.

4>Functions can be called from procedure whereas procedures
cannot be called from function.

5>Exception can be handled by try-catch block in a procedure
whereas try-catch block cannot be used in a function.

6>We can go for transaction management in procedure whereas
we can't go in function.

7>Procedures can not be utilized in a select statement
whereas function can be embedded in a select statement.

Is This Answer Correct ?    22 Yes 4 No

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

Answer / bhupi

SP return a single result-set,
SP works with table variables,
SP uses EXEC stmts

Is This Answer Correct ?    28 Yes 12 No

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

Answer / arvind kumar

there main difference:::
1 sp takes input,output parameters, function takes only
input parameters.
2 temparary variables required to store return values of
sp. in functions temparary variables will be optinale.
3 sp can not be called directly into DML statements ,
functions can be called directly into DML statements.

Is This Answer Correct ?    13 Yes 2 No

Post New Answer

More SQL Server Interview Questions

What are the magic tables in SQL Server 2000?

7 Answers   Infogain, Merrill Lynch,


what is extended StoreProcedure ?

3 Answers   Satyam,


What is a group function explain with an example?

0 Answers  


Explain what is it unwise to create wide clustered index keys?

0 Answers  


What are the types of subquery?

0 Answers  


How To Find That One Week Change in My DataBase we Have Done Like We Have A database Test I Change Table,Stored Procd. Then I Find Which SP,Table We Have Edit/Change in Seven Dayes

1 Answers   INDUS,


What is difference between equi join and natural join?

0 Answers  


Explain partitioned view?

0 Answers  


Please explain that what are the basic functions for master, msdb, model, tempdb and resource databases? : SQL Server Architecture

0 Answers  


How to convert numeric expression data types using the cast() function?

0 Answers  


Explain what is lock escalation and what is its purpose?

0 Answers  


What is sql service broker?

0 Answers  


Categories