Previewing SQL Statements

Click the Preview tab in an object property sheet to view the SQL code associated with the object before it is generated. The code displayed is read-only and reflects the options selected in the Database Generation dialog box.

For more information on database generation options, see Generating a Database from a PDM.

The text in the script preview is color coded as follows:

Text color

Represents

Blue

SQL reserved word

Black

Statement body

Red

Variable

Green

Comment

You can use the following tools and keyboard shortcuts from the Preview toolbar:

Tool

Description

Keyboard shortcut



Editor contextual menu

Shift + F11



Refresh

F5



This tool is available when at least one extended model definition flagged for generation is linked to the model and when it contains GeneratedFiles entries for the current object. When available, it displays the list of targets for the current object. If you add a generation target, the corresponding tab is added to the Preview tab. If you deselect a generation target, the corresponding tab disappears from the Preview tab

Ctrl + F6



Show generation options

Ctrl + W



Ignore generation options

Ctrl + D

For more information on extended model definitions used for generation, see "Extended Model Definitions" in the Resource Files and the Public Metamodel chapter of the Customizing and Extending PowerDesigner manual.

Changing Generation Options

If you click the Change Generation Options tool, the Generation Options dialog box is displayed. You can change generation options and preview their effect on the code.

Ignore Generation Options

If you click the Ignore Generation Options tool, the preview ignores generation options selected by using the Change generation options tool but uses a predefined set of options.

Selected tool

Effect on generation options

Effect on preview

Change generation options

You can select generation options

Visible in Preview if options are applicable

Ignore generation options

Generation options currently selected are overridden by predefined set of options

Only predefined options are visible in Preview

Change generation options + Ignore generation options

You can select generation options

Changes ignored in Preview

The predefined set of generation options selects these items:

Generation Option Tab

Selected items

Tables and Views

All items except drop options

Keys and Indexes

All items except options represented differently in some DBMS. For example, if a database is auto indexed, the index options corresponding to the keys are not selected

Database

All items except drop options

Options

All user-defined options are used

In the SQL Editor or SQL Preview tab, you can add and remove bookmarks at specific points in the SQL script and then navigate forwards or backwards from bookmark to bookmark:

Keyboard shortcut

Description

Ctrl + F2

Adds a new bookmark. A blue bookmark box is displayed. If you repeat this action from the same position, the bookmark is deleted and the blue marker disappears

F2

Jumps to next bookmark

Shift + F2

Jumps to the previous bookmark

Note that bookmarks are not printable and are lost if you use the Refresh, Change Generation or Ignore Generation options.