Microsoft SQL Stored Procedures for beginners
Microsoft SQL Stored Procedures for beginners, Build Stored Procedures in SQL Server.
SQL Server stored procedure is a batch of statements grouped as a logical unit and stored in the database. The stored procedure accepts the parameters and executes the T-SQL statements in the procedure, returns the result set if any.
SQL Server stored procedure is a batch of statements grouped as a logical unit and stored in the database. The stored procedure accepts the parameters and executes the T-SQL statements in the procedure, returns the result set if any.
Benefits of using a stored procedure
- We can easily modify the code inside the stored procedure without the need to restart or deploying the application.
- Reduced network traffic: When we use stored procedures instead of writing T-SQL queries at the application level, only the procedure name is passed over the network instead of the whole T-SQL code.
- Reusable: Stored procedures can be executed by multiple users or multiple client applications without the need of writing the code again.
- Security: Stored procedures reduce the threat by eliminating direct access to the tables. we can also encrypt the stored procedures while creating them so that source code inside the stored procedure is not visible.
- Performance: The SQL Server stored procedure when executed for the first time creates a plan and stores it in the buffer pool so that the plan can be reused when it executes next time.