What Are Stored Procedures?

In the Microsoft SQL Server documentation, a stored procedure is defined as “a precompiled collection of SQL statements and optional control-of-flow statements stored under a name and processed as a unit.” Put more simply, a stored procedure is like a method or function—it performs a set of actions on the data in your database. They normally encapsulate an area of functionality, such as adding a new record to a table, or returning a specific set of information.

Stored procedures offer a number of benefits. First, because they are precompiled, they generally perform better than a straight SQL call directly from your application. Additionally, by channeling all data access in your application through a set of stored ...

Get Sams Teach Yourself ADO.NET in 24 Hours now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.