Showing posts with label What are the advantages of using Stored Procedure?. Show all posts
Showing posts with label What are the advantages of using Stored Procedure?. Show all posts

Monday, 1 May 2017

What are the advantages of using Stored Procedure?

In this post, I will explain advantages of using Stored Procedure in SQL Server.

Stored Procedure is a group of SQL statements that have been created and stored in the database. A Stored Procedure will accept input parameters so that a single procedure can be used over the network by several clients using different input data. If we modify a Stored Procedure all the clients will get the updated Stored Procedure.

Syntax of creating Stored Procedure-
CREATE PROCEDURE procedurename
@parameter datatype
AS
            Body of the stored procedure (SQL Statements)

Advantages of using Stored Procedure-
  • Stored Procedure can reduce network traffic, boosting application performance.
  • Stored Procedure execution plans can be reused, staying cached in SQL Server's memory, reducing server overhead.
  • Stored Procedures help promote code reuse.
  • Stored Procedures can encapsulate logic. You can change stored procedure code without affecting clients.
  • Stored Procedures provide better security to your data.