Previous Topic: Migrate a Stored ProcedureNext Topic: Define a Stored Procedure


Add a Stored Procedure for a Table or View

You can add a new stored procedure in a physical model using the Stored Procedure Editor. The order in which you add stored procedures to your model is important. The stored procedure code is generated according to the order the stored procedures display in the Stored Procedure Editor. You can change this order at any time by using the up and down arrow buttons on the Object Creation Order tab in the Stored Procedure Editor.

To add a new stored procedure

  1. Click Stored Procedures on the Model menu.

    The Stored Procedure Editor opens.

  2. Click the New New icon in property editors to create a new object button.

    A new stored procedure is added to the Navigation Grid with a default name. You can change the name in this field.

  3. Work with the following options:
    Name

    Specifies the name of the stored procedure. Change the name of the stored procedure in this field.

    Type

    Specifies whether the stored procedure type is model-level or table-level. Select the type from the drop-down list.

    Attach To New

    Specifies to attach the selected stored procedure to each new table or view that you create. Clear the check box if you want to manually attach the stored procedure to new tables or views.

    Generate

    Generates SQL during forward engineering. Clear the check box if you do not want to generate SQL.

  4. Work with the other tabs in the editor to access additional design features, such as:
  5. Click the Stored Procedure Browser button Macro/Stored Procedure Browser Icon to attach tables and views in the model to the stored procedure.
  6. (Optional) Click the Comment tab and enter any comments that you want to associate with the stored procedure.
  7. (Optional) Click the UDP tab to work with user-defined properties for the stored procedure.
  8. (Optional) Click the Notes tab to view history information and view or edit user notes.
  9. Click Close.

    The stored procedure is added and the Stored Procedure Editor closes.

More information:

DBMS Support for Stored Procedures

Define a Stored Procedure

Define the Stored Procedures SQL Code

Review the Expanded SQL Code for a Stored Procedure

Enter a Comment for a Stored Procedure

Enter Stored Procedure User-Defined Property Values

Procedure Browser