Previous Topic: Add a New ScriptNext Topic: View a Script for a Model, Table or View


Define a Pre & Post Script

Use the Script Template Editor to define the properties for a script in a physical model.

To define a script

  1. Click Script Templates on the Model menu.

    The Script Template Editor opens.

  2. Select the script in the Navigation Grid that you want to define.

    Note: Click New New icon in property editors to create a new object on the toolbar to create a new script. Use the Enter filter text box to filter a very large list of scripts to quickly locate the one that you want to define.

  3. Work with the following options:
    property editor PREVIOUS icon Previous

    Positions the editor on the previous script in the Navigation Grid.

    property editor NEXT icon Next

    Positions the editor on the next script in the Navigation Grid.

    property editor SORT icon Sort

    Sorts the scripts by alphabetic or reverse alphabetic order. You select the method you want using the drop-down menu that opens after you click the Sort button.

    New icon in property editors to create a new object New

    Creates a new script that becomes the current object in the editor.

    property editor DELETE button Delete

    Deletes the selected script.

    Macro/Stored Procedure Browser Icon Script Template Browser

    Opens the Script Template Browser so you can view the tables and views that are attached to a table-level script, view the code that is used by a table-level script, and attach tables and views in a model to a script.

    Note: This option is only available for table-level scripts.

    property editor HELP button Help

    Accesses online help for the editor.

    enter filter text box in a property editor to filter object list

    Lets you enter text to filter a large list of scripts so you can quickly locate the one that you want.

    Name

    Displays the name of the script. You can change the name in this field.

    Type

    Displays the script type. Select the script type using the drop-down control.

    Generate As

    Specifies whether to generate the script as a pre-script.

    Attach To New

    Specifies to attach the selected script to each new table that you create. Clear the check box if you want to manually attach the script to new tables.

    Generate

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

  4. Click the Code tab to work with the SQL code (including macros) for the selected script.
  5. Click the Object Creation Order tab to specify script execution order.
  6. (Optional) Click the Expanded tab to view expanded SQL code.
  7. (Optional) Click the Comment tab and enter any comments that you want to associate with the script.
  8. (Optional) Click the UDP tab to work with user-defined properties for the script.
  9. (Optional) Click the Notes tab to view or enter user notes that you want to associate with the script.
  10. Click Close.

    The script is defined and the Script Template Editor closes.

More information:

Add a New Script

View a Script for a Model, Table or View

Change the Order of Script Execution

Generate a Script to the Schema

Define Script SQL Code

Enter a Script Comment

Define Script User-Defined Property Values