ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   SiteMap shows list of All Categories in this site.
Google
 
Categories  >>  Software  >>  Databases  >>  SQL Server
 
 


 

 
 Oracle interview questions  Oracle Interview Questions
 SQL Server interview questions  SQL Server Interview Questions
 MS Access interview questions  MS Access Interview Questions
 MySQL interview questions  MySQL Interview Questions
 Postgre interview questions  Postgre Interview Questions
 Sybase interview questions  Sybase Interview Questions
 DB Architecture interview questions  DB Architecture Interview Questions
 DB Administration interview questions  DB Administration Interview Questions
 DB Development interview questions  DB Development Interview Questions
 SQL PLSQL interview questions  SQL PLSQL Interview Questions
 Databases AllOther interview questions  Databases AllOther Interview Questions
Question
What are the differences between stored procedure and
functions in SQL Server 2000?
 Question Submitted By :: Honeysukumar
I also faced this Question!!     Rank Answer Posted By  
 
  Re: What are the differences between stored procedure and functions in SQL Server 2000?
Answer
# 1
The Text property exposes the Transact-SQL or other script 
that defines the referenced Microsoft? SQL Server? 2000 
database object.

The FunctionName property specifies the function name to 
call in the Microsoft? ActiveX? script associated with a 
script task or step.
 
Is This Answer Correct ?    9 Yes 12 No
Lrk
 
  Re: What are the differences between stored procedure and functions in SQL Server 2000?
Answer
# 2
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 ?    19 Yes 5 No
Pavan Pareta
 
 
 
  Re: What are the differences between stored procedure and functions in SQL Server 2000?
Answer
# 3
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 ?    14 Yes 5 No
Vampire007
 
  Re: What are the differences between stored procedure and functions in SQL Server 2000?
Answer
# 4
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 ?    10 Yes 3 No
Srinivas
 
  Re: What are the differences between stored procedure and functions in SQL Server 2000?
Answer
# 5
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 ?    5 Yes 3 No
Vijayabhaskarreddy
 
  Re: What are the differences between stored procedure and functions in SQL Server 2000?
Answer
# 6
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 ?    12 Yes 2 No
Ugandhar
 
  Re: What are the differences between stored procedure and functions in SQL Server 2000?
Answer
# 7
SP return a single result-set,
SP works with table variables,
SP uses EXEC stmts
 
Is This Answer Correct ?    6 Yes 1 No
Bhupi
 
  Re: What are the differences between stored procedure and functions in SQL Server 2000?
Answer
# 8
Function return only one value where as procedure can more 
than
 
Is This Answer Correct ?    9 Yes 1 No
Pss
 
  Re: What are the differences between stored procedure and functions in SQL Server 2000?
Answer
# 9
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 ?    15 Yes 0 No
Bed Singh
 
  Re: What are the differences between stored procedure and functions in SQL Server 2000?
Answer
# 10
function cant return Result set where
procedure can
 
Is This Answer Correct ?    2 Yes 2 No
Tarun Waia
 
  Re: What are the differences between stored procedure and functions in SQL Server 2000?
Answer
# 11
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 ?    5 Yes 1 No
Arvind Kumar
 
  Re: What are the differences between stored procedure and functions in SQL Server 2000?
Answer
# 12
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 ?    4 Yes 0 No
Prashant
 

 
 
 
Other SQL Server Interview Questions
 
  Question Asked @ Answers
 
What is Files and Filegroups in SQL Server & it's implementation. Zenith1
Plz tell about backup&recovery?  2
we have emp table like Ename,EDOJ,EDOB with Column structure.but we want to know the employee Age.How? Any Body Plz  6
How to delete duplicate records from a table?(for suppose in a table we have 1000 Records in that we have 200 duplicate Records , so ,how to findout that duplicate Records , how to delete those Records and arranged into sequence order? one more thing that there is no primary key at all) McAfee4
What is difference beteen Migration and Upgrdation? Satyam4
How do you simulate a deadlock for testing purposes  1
What is Report Server,Report Manager and Report Builder in SSRS 2005?  1
What's the difference between a primary key and a unique key? Wipro8
how many joins we can write if at all we have n no of tables Tanla-Solutions4
what is the main difference between constraints(like primary key etc..)& joins? Annik2
If there is failure during updation of certain rows, what will be the state?  1
what is extended StoreProcedure ? Satyam3
Which is better in performance - CONSTRAINT or TRIGGER over a column which restricts say an input of particular value in a column of a table? Accenture3
how to rest identity columns in sql server Matrix3
what is the signification difference of this bit data type between sql 6.5 and later version sql server?  1
wht is normalization?can u explain me in detail? TCS6
I Have Employee table having column name as ID,SALARY how to get second max salary from employee table with id ex ID SALARY 1 20000 7 37000 2 5000  11
How to delete an attribute from the emp table  3
What is normalization in Database ?  4
How to Display, Amount of Disk Activity Generated by Transact-SQL Statements?  1
 
For more SQL Server Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com