Stored procedures can make managing your database and displaying information about that database and its users much easier. Stored procedures are a precompiled collection of SQL statements and optional control-of-flow statements stored under a name and processed as a unit. Stored procedures are stored within a database; can be executed with one call from an application; and allow user-declared variables, conditional execution, and other powerful programming features.
Stored procedures can contain program flow, logic, and queries against the database. They can accept parameters, output parameters, return single or multiple result sets, and return values.
You can use stored procedures for any purpose for which you would use SQL statements, with these advantages:
The functionality of a stored procedure is dependent on the features offered by your database. For more details about what a stored procedure can accomplish for you, see your database documentation.
When you create a stored procedure in Microsoft® Visual Database Tools™, the stored procedure appears in the Stored Procedures folder in Data View. You can expand a stored procedure in Data View to see a list of the parameters it contains.
For details about working with stored procedures, see the following topics:
To | See |
Create stored procedures to be executed from the database | Creating a Stored Procedure |
Set execute permissions to allow access to the stored procedures by specific users | Setting Execute Permissions on Stored Procedures |
Use parameters in stored procedures | Using Parameters in Stored Procedures |
Open a stored procedure to view or edit its text | Opening a Stored Procedure |
Save stored procedures | Saving a Stored Procedure |
Delete stored procedures | Deleting a Stored Procedure |
Copy stored procedures | Copying a Stored Procedure |
Run stored procedures against your database | Running a Stored Procedure |
Change the name of a stored procedure | Renaming a Stored Procedure |