Creating a model from an SQL script

You can create a model by parsing an SQL script, which generates the schema definitions for the model.
Prerequisites: You must have an existing SQL script and a project in the Data Project Explorer view before creating a model.
To create a model from an SQL script, complete the following steps:
  1. From the main menu bar, click File > New > Physical Data Model. The New Physical Data Model wizard starts.
    You can also invoke the New Physical Data Model wizard by using either of the following methods:
    • Click the down arrow on the New button on the main menu bar, and click Physical Data Model.
    • Right-click a project in the Data Project Explorer view, and click New > Physical Data Model.
  2. Complete the steps in the New Physical Data Model wizard to create a new model:
    1. Select the destination folder (or project) into which to place the model.
    2. Choose to create the model from reverse engineering with DDL script as the source.
    Restriction: The following restrictions apply when you create a model from a SQL script:
    • If the SQL script creates a table with a primary key, a unique index is not automatically created for the primary key. Therefore, if you compare a model that was created from the DB2 catalog with a model that was created from equivalent DDL, the Comparison Editor will detect that the model from the catalog has a unique index for the primary key and the model from the SQL script does not.
    • If the SQL script creates an alias for a table, the script must also include a CREATE statement for the table on which the alias is defined. Otherwise, because no information for the table columns exists, the columns for the alias cannot be created.
    • The SQL script must not include a CREATE statement for table space SYSCATSPACE, which is a system-generated table space. If the DDL script contains ALTER statements for table space SYSCATSPACE, DB2® Change Management Expert creates a table space named SYSCATSPACE in the model, sets the attributes with the values that are specified in the statement, and uses the default value with which the table space is created for the attributes that are not specified. Thus, the values in the model of SYSCATSPACE that is created from the SQL script might not match the values in the actual database.
The model is added to your project, and it is displayed in the navigation tree. You are now ready to work with the model.


Feedback

Copyright IBM Corporation 2006, 2007. All Rights Reserved.