Designing Stored Procedures (Database Engine)



Almost any Transact-SQL code that can be written as a batch can be used to create a stored procedure.

Rules for Designing Stored Procedures

Rules for designing stored procedures include the following: 

The CREATE PROCEDURE definition itself can include any number and type of SQL statements, except for the following statements. These cannot be used anywhere within a stored procedure.

Read more: Designing Stored Procedures (Database Engine)

 

Types of Stored Procedures



There are many types of stored procedures available in Microsoft SQL Server 2005. This topic briefly describes each stored procedure type and includes an example of each.

Read more: Types of Stored Procedures

 

Stored Procedure Basics



Typical uses for stored procedures include data validation (integrated into the database) or access control mechanisms. Furthermore, stored procedures are used to consolidate and centralize logic that was originally implemented in applications. Large or complex processing that might require the execution of several SQL statements is moved into stored procedures and all applications call the procedures only.

Read more: Stored Procedure Basics