Creating a Stored Procedure

You can use any stored procedures that appear in the Stored Procedures folder for a database in Data View. Or you can create your own stored procedures that can be executed from the database you’re connected to.

To create a new stored procedure

  1. In Data View, right-click the Stored Procedures folder or any stored procedure in that folder.

  2. Choose New Stored Procedure from the shortcut menu.

  3. A new stored procedure is created using skeleton SQL statements.

  4. If desired, replace StoredProcedure1 in the first line with the name of the procedure. For example, you might use "MyProcedure" as the name:
    Create Procedure MyProcedure
    

    Note   Stored procedures must have unique names. If you choose a name that is already assigned to another stored procedure in your project, an error message warns you that a stored procedure with that name already exists.

  5. Write the remaining procedure text in SQL.

For more information and examples of stored procedures, see the documentation for your database server. If you are using Microsoft® SQL Server™, see "CREATE PROCEDURE statement" in SQL Server Books Online.