Thursday, August 22, 2013

Filled Under:
, ,

Difference between Stored Procedure and Function In Sql

Hello Friends,

Today I am writing this post because of this is very important question in interview 

Inside procedure we can use DML (Insert /Update/Delete) statements, But Inside function we can not use DML statements.

Procedure can have both input\output parameters,  But Function can have only input parameter.

We can use Try-Catch Block in Stored Procedure, But In Function We can not use Try-Catch block.

We can not use Stored Procedure in Select statement, But In Function We can use in Select statement.

Stored Procedure can return 0 or n values (max 1024), But Function can return only 1 value which is mandatory.

Stored Procedure can not be call from Function, But We can call function from Stored Procedure.

We can use transaction in Stored Procedure, But In function we can not use transaction.

We can not use Stored Procedure in Sql statement anywhere in the Where/Having/select section, But In function we can use.

We can not join Stored Procedure, But we can  join function.


If you like this post share it.. If you encounter any problems, feel free and comment below to find solution. Share Your Experience with us.







0 comments:

Post a Comment