From the course: Developing Microsoft SQL Server 2016 Databases

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Introduction to stored procedures

Introduction to stored procedures

- [Instructor] Stored procedures are SQL's servers way of bundling blocks of code into reusable units that can be called by an application or other user of a database. These can be anything, from a simple SELECT statement, or a more complex collection of database requests, programmatic functions, and loops. There are several benefits to using stored procedures over issuing raw T-SQL commands to the database. First, they're more consistent. Every time I ask for a customer's order using a stored procedure, I can be assured that the database will process all of the tables involved in such a query in exactly the same way. Further, when all the applications that interact with a database utilize the same stored procedure, it makes maintenance much easier. To make a change, you simply update the single stored procedure that they all reference, rather than update every application's internal logic if they were…

Contents