Interviews11 answers
11 Answers
1- store procedure have input and output parameter, but FUNCITON: have only input parameter.
2-store procedure can do DML process, but FUNCTION can not do that.
3-store procedure return multiple value but FUNCTION return only one value.
4-In store procedure you can call FUNCTIONS but in Function you can't call store procedure.
Abduljamal BashaPosted Sep 29, 2016, 8:53 AM EDT
Functions can have only input parameters for it whereas Procedures can have input/output parameters .
Procedures can have input, output parameters for it whereas functions can have only input parameters.
Nitin ChoudharyPosted Jan 20, 2015, 2:33 AM EST
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 allows select as well as DML statement in it whereas function allows 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 cannot be utilized in a select statement whereas function can be embedded in a select statement.
Sarath KumarPosted Jan 4, 2015, 6:56 PM EST
http://www.c-sharpcorner.com/UploadFile/996353/difference-between-stored-procedure-and-user-defined-functio/
http://dotnet-munesh.blogspot.in/2013/12/difference.html
Munesh SharmaPosted Oct 9, 2014, 1:01 AM EDT
Stored Procedure.
1)In sp we can do all dml operations ,in function only select operation is possible
2)In sp we can return more than one value ,in functions only single value is returned.
3)we can call functions inside sp, but we can't call sp inside functions.
Roymon TPPosted Oct 8, 2014, 10:29 PM EDT
Stored Procedure.
1)In sp we can do all dml operations ,in function only select operation is possible
2)In sp we can return more than one value ,in functions only single value is returned.
3)we can call functions inside sp, but we can't call sp inside functions.
Roymon TPPosted Oct 8, 2014, 10:29 PM EDT
function is preferred over stored procedure when some of the recurring functionality you want to implement inside database ( within database objects)where as stored procedure is preferred when want to implement recurring functionality between database and client application(e.g. .NET)
ashok rathodPosted Apr 7, 2014, 3:19 AM EDT
Function must return a value but in Stored Procedure it is optional( Procedure can return zero or n values).
Functions can have only input parameters for it whereas Procedures can have input/output parameters .
Function takes one input parameter it is mandatory but Stored Procedure may take o to n input parameters..
Functions can be called from Procedure whereas Procedures cannot be called from Function.
Advance Difference
Procedure allows SELECT as well as DML(INSERT/UPDATE/DELETE) statement in it whereas Function allows only SELECT statement in it.
Procedures can not be utilized in a SELECT statement whereas Function can be embedded in a SELECT statement.
Stored Procedures cannot be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section whereas Function can be.
Functions that return tables can be treated as another rowset. This can be used in JOINs with other tables.
Inline Function can be though of as views that take parameters and can be used in JOINs and other Rowset operations.
Exception can be handled by try-catch block in a Procedure whereas try-catch block cannot be used in a Function.
We can go for Transaction Management in Procedure whereas we can't go in Function.
Khan Abrar AhmedPosted Apr 6, 2014, 3:58 AM EDT
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 allows select as well as DML(INSERT/UPDATE/DELETE) statements in it whereas function allows 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 cannot be utilized in a select statement whereas function can be embedded in a select statement.
Abhay ShankerPosted Apr 2, 2014, 2:09 AM EDT
1.Procedure can have Input Parameter and Output Parameter.
Function only have Input Parameter.
2.For Stored Procedure Return type is not must.
For function return type is must.
3.Stored Procedure Can have Try....Catch
Function cannot have Try....Catch
4.Functions can be called from Procedure whereas Procedures cannot be called from Function
Sarath KumarPosted Mar 26, 2014, 6:22 AM EDT
1. Procedure can have Input Parameter and Output Parameter.
Function only have Input Parameter.
2. Procedure allow INSERT/UPDATE/DELETE Statement.
Function allow SELECT Statement only.
3. Procedure can handle Exception Handling.
Function cannot handle Exception Handling.
4. Procedure can call a Function.
Function cannot execute Procedure.
KalaiPosted Mar 21, 2014, 2:56 AM EDT







