Create User-Defined SQL Code for a Materialized Query Table

You can use the User Defined SQL tab in the Materialized Query Tables editor to view and change the SQL code that is maintained for a materialized query table.

You should create user-defined SQL only if you want the materialized query table to contain syntax that erwin® Data Modeler cannot represent, such as a complex JOIN statement. When you create user-defined SQL, erwin® Data Modeler no longer maintains references to the base tables and columns to which the materialized query table refers, and any relationships to source tables in the model are no longer maintained.

To create user-defined sql code for a materialized query table

  1. Right-click a Materialized Query Table in the Model Explorer and select Properties from the drop-down menu.

    The Materialized Query Table Editor opens.

  2. Click the User Defined SQL tab.
  3. Select the User-Defined SQL check box to activate the text entry area.
  4. Enter your user-defined SQL in the text box. You can use cut, copy, paste, and edit options on the toolbar to work with your text. Click the Macro Toolbox icon to add a macro.
  5. Click Close.

    Your changes are saved and the Materialized Query Table Editor closes.