Previous Topic: View Trigger Template Macro CodeNext Topic: DBMS Support for Scripts


Scripts

SQL scripts are executed either before or after the rest of the schema is generated, or included before or after the CREATE TABLE statement.

It is necessary to write scripts to provide for proper schema generations, but it also can involve a lot of copying, pasting, and renaming to put it all in place. Macro support lets you generate scripts by writing these scripts using a combination of regular SQL and, whenever possible, macros to guarantee reusability and avoid the repetitive copying, pasting, and renaming. Scripts are supported for:

You can create scripts using templates, which can contain both SQL code and macros. The macros help you add the name and properties of objects in the script code. The macros are expanded based on the current state of a model when it generates the schema to the target database.

Scripts have the following characteristics:

erwin® Data Modeler macros provide a method to create scripts that are reusable. Here are some examples of the script use:

Note: Scripts can be saved in a erwin® Data Modeler template for easy reuse.

More information:

Schema Script Example

Add a New Script

Define a Pre & Post Script

Define Script SQL Code

Enter a Script Comment

Define Script User-Defined Property Values