Share via


How to: Create and Manage Stored Procedures

You can create, edit, copy, and delete stored procedures in your database. A stored procedure is Visual FoxPro code that is stored in the database (.dbc) file and operates specifically on data in the database.

To create a stored procedure

  1. Open the database in the Database Designer.

  2. On the Database menu, click Edit Stored Procedures.

An editing window opens so you can write code for the stored procedure.

To create a stored procedure for a database in a project

  1. Open the project in the Project Manager.

  2. In the Project Manager, expand the Data node, the Databases node, and then the database node in which you want to add a stored procedure.

  3. Click the Stored Procedures node and then New.

An editing window opens so you can write code for the stored procedure.

To create a stored procedure programmatically

  • Use the MODIFY PROCEDURE command.

For more information, see MODIFY PROCEDURE Command.

To edit a stored procedure

  • Perform one of the following:

    • To edit a stored procedure from the Database Designer, on the Database menu, click Edit Stored Procedures.

    -OR-

    • To edit a stored procedure from the Project Manager, click the Stored Procedures node, and then Modify.

    • -OR-

    • Use the MODIFY PROCEDURE command.

An editing window opens so you can edit code for the stored procedure.

To copy and append stored procedures to a text file

  • Use the COPY PROCEDURES and APPEND PROCEDURES commands.

For more information, see COPY PROCEDURES Command and APPEND PROCEDURES Command.

To delete a stored procedure

  1. Open the editing window for the stored procedure.

  2. In the editing window, select the code you want to delete.

  3. Press the DELETE key.

See Also

Tasks

How to: Open Databases

Concepts

Handling Database Errors

Reference

Databases in Visual FoxPro

Other Resources

Creating Databases