Differnce between Stored procedure and user defined functions?

Answers were Sorted based on User's Feedback



Differnce between Stored procedure and user defined functions?..

Answer / ashok

Main difference between sp and function is we cannot use
store procedure in select statement where as we can use
function in select statement.

Is This Answer Correct ?    32 Yes 4 No

Differnce between Stored procedure and user defined functions?..

Answer / suresh jayaraman

Procedure-is also called Proc

proc-parsing resloving organizing compiling

stored Procedure once compiled and run many times,when we
create procedure,that procedure is stored in executeplan,so
no need to recompile.

but fuction every time compiling and running.

Is This Answer Correct ?    21 Yes 4 No

Differnce between Stored procedure and user defined functions?..

Answer / ramesh

stored proc is a precompiled one.

Is This Answer Correct ?    18 Yes 1 No

Differnce between Stored procedure and user defined functions?..

Answer / suresh mandala

1>Stored Procedure returns morethan one value where as
Function returns only one value
2>stored procedure we may use return statement.. but in
userdefined function we should use return statement
3>stored procedure is precomplied but function compile each
time we call it.

If u have any quieries ask me ,i will try

Is This Answer Correct ?    17 Yes 1 No

Differnce between Stored procedure and user defined functions?..

Answer / shivendra pandey

stored procedure is precomplied and not return value by
default but function compile each time and use return
statement simply.
if u r using database then use stored procedure for
pefmance n if u are working with simple pl for some
calculation go for function

Is This Answer Correct ?    15 Yes 3 No

Differnce between Stored procedure and user defined functions?..

Answer / ramesh

stored procedure we may use return statement.. but in user
defined function we should use return statement

Is This Answer Correct ?    14 Yes 5 No

Differnce between Stored procedure and user defined functions?..

Answer / urvish

store procedure can return Output Parameters where function
can not return output parameters.

Is This Answer Correct ?    12 Yes 4 No

Differnce between Stored procedure and user defined functions?..

Answer / suraj

1)sp are pre comiled so while execution time it save time
2)sp returns many values where as function return only one
value

Is This Answer Correct ?    10 Yes 2 No

Differnce between Stored procedure and user defined functions?..

Answer / saiprasad

u cannot change any datatype in database using udf

u can do everything with a storedprocedure

udf cannot be used in XMl Clause but sp's can be used

Is This Answer Correct ?    6 Yes 0 No

Differnce between Stored procedure and user defined functions?..

Answer / sivacharan svs

Funtion Should Return a value
Procedure may or may not return a value
Function can be used in Your Select Quries
Procedure has to be passed with or with out parameters
Select Getdate() as date
Function returns date time here


The resultant value of the stored procedure can be used in
application where as the resultant value of the stored
procedure is used in a query.

Is This Answer Correct ?    4 Yes 0 No

Post New Answer

More ADO.NET Interview Questions

What is the difference between data grid and data repeater?

0 Answers  


What is the significance of CommandBehavior.CloseConnection ?

0 Answers   NA,


How do you sort the data in datagrid?

4 Answers   Choice Solutions,


How can we load multiple tables in a dataset?

0 Answers  


What is ado oledb and odbc?

0 Answers  






What is the executescalar method?

0 Answers  


How would you connect to a database by using .NET?

0 Answers  


What is variable view?

0 Answers  


Give few examples of datareader that is used in different dataproviders.

0 Answers  


What do you know about ado.net's methods?

0 Answers  


Which type of database is used while processing dynamic database?

1 Answers   Microsoft,


How To Update A Column In A DataGrid Using C#.NET? I am getting InvalidCastException as (Specified cast is not valid) while updating 2nd column in a datagrid? Id,firstname,lastname are the three columns of my datagrid respectively. I wanted to edit the second column(lastname) and update it. I did the following code in DataGrid's updatecommand(),but failed to update ! Int varid=(int)DataGrid1.DataKeys[e.Item.ItemIndex]; TextBox lnm=(TextBox)e.Item.Cells[2].Controls[0]; string str=lnm.Text ; SqlCommand cmd=new SqlCommand("update customer set lastname='" + str + "' where id=" + varid + "",con); cmd.ExecuteNonQuery(); DataGrid1.EditItemIndex=- 1; DataGrid1.DataBind();

2 Answers   Mind Tree, TCS,


Categories