SQL Interview Question | Procedure Vs Function

Опубликовано: 15 Август 2021
на канале: DataGuru Naval
63
5

For database related videos, please subscribe channel
   / @datagurunaval  

SQL Interview Question | Procedure Vs Function

Stored Procedure

A Stored Procedure is nothing more than prepared SQL code that you save so you can reuse the code over and over again. So if you think about a query that you write over and over again, instead of having to write that query each time you would save it as a Stored Procedure and then just call the Stored Procedure to execute the SQL code that you saved as part of the Stored Procedure.


User Defined Functions

Like functions in programming languages, SQL Server User Defined Functions are routines that accept parameters, perform an action such as a complex calculation, and returns the result of that action as a value. The return value can either be a single scalar value or a result set.