What is different between Stored Procedure and Function in SQL server ?

0 votes
20 views
Sanat Shukla asked 10 days ago in Database by Sanat Shukla

Stored Procedure and Function in SQL server.

1 Answer

0 votes
Arti Mishra answered 2 hours ago by Arti Mishra
“Difference between Stored Procedure and Function”
Stored Procedure 
  • The stored procedure returns 0 or n(multiple) values.
  • A function can be called within a procedure.
  •  A procedure can use both input-output parameters.
  • In Procedure, for handling exception, we can use the try-catch block.
  • It can return multiple result set.
  • Execute statement can be used to call a stored procedure.
  •  By the help of procedure, you can change environment parameter.

Function
  • A function always returns value.
  • Procedure can’t call within a function.
  • Function can use only input parameter.
  • It can’t use try-catch block for exception handling.
  • It always returns a single result set.
  • Select statement is used for function calls.
  • Function can’t change environment parameter.


"Thanks For Reading"