There are lot of Advantages of creating a stored procedure instead of running DB scripts individually.
Below are the major reasons which tell us why we use stored procedures in DB.
- The Best feature of stored procedures is, compile once and execute as many times as we can.
- We can easily store the group of scripts in database and provide better security to our data by granting Execute permissions on it.
- We can reduce the network traffic by sending the hundreds of lines of code as a single statement.
- When we compile it first time, it creates an execution plan for it and cached in memory for future. It improves the performance by utilizing this execution plan when we execute it next time.