Generating a DDL script

After you change the default database user, you can generate DDL directly from the data model. PowerDesigner saves the results in a SQL script that you use to generate the tables and other objects in the target database.

NoteNote Use the model RAP_IQ.pdm to generate DDL for the VLDBServer database. Do not use a different model by changing the target database to IQ, as this will result in the loss of index information.

  1. Click Database | Generate Database.

  2. On the Database Generation dialog, click the browse button and choose the directory where you want to store the script. Click OK.

  3. In the File name box, type a name for the SQL script. You will use this script in the next procedure.

  4. On the Tables & Views, Keys & Indexes, Database, and Options tabs, set options as listed in the following table:

    On this tab...

    In this panel...

    Set these options...

    Tables & Views

    Tables

    Create table

    Keys & Indexes

    Primary keys

    Create primary key Inside Table

    Indexes

    Create index

    Foreign keys

    Create foreign key Outside Declarative Integrity

    Database

    Turn all options off

    Options

    Accept all defaults

    NoteIf you select User-defined type in the Columns panel of the Tables & Views tab, you must also select Create data type in the User-defined data types panel of the Database tab. PowerDesigner generates correct data types in the DDL script, even if you do not select this pair of options.

  5. Click the Selection tab.

    The Selection tab includes two drop-down boxes: the drop-down box on the left is used to choose the RAP model to generate, and the drop-down box on the right is used to choose the database owner.

  6. From the drop-down box on the right, choose the database owner.

  7. On the Tables tab, click the Select All button, which is to the right of the database owner drop-down box.

  8. On the Domains tab, choose the database owner, click the Select All button, click Apply, then click OK.

    PowerDesigner checks the model for any errors, builds a result list, and generates the DDL. The Result dialog appears, which identifies the name and location of the generated file. You can click the Edit button on the Result dialog to view the generated script. Close the Result dialog.

    The Result List dialog appears in the background and may include several warnings, for example, "Existence of index" and "Existence of reference." These warnings normally occur during generation.

  9. Close the Result List dialog, then exit PowerDesigner.

NoteIndexes in the VLDBServer database As delivered, the RAP_IQ.pdm data model includes only those indexes that support the sample queries. Statements needed to create these indexes appear in the DDL scripts generated from the RAP IQ data model. Consequently, the indexes supplied with the model are created automatically when you run the corresponding DDL scripts.

Depending on site-specific issues such as limits on the available load time and the actual queries in the database, you may want to add or remove indexes from the RAP IQ data model. For detailed information on IQ indexes, refer to the Sybase IQ product documentation.