Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
DOCUMENTATION
December 1997
Copyright 1991-1997 Sybase, Inc. and its subsidiaries.
All rights reserved.
Printed in the United States of America.
Information in this manual may change without notice and does not represent a commitment on the part of
Sybase, Inc. and its subsidiaries.
The software described in this manual is provided by Powersoft Corporation under a Powersoft License
agreement. The software may be used only in accordance with the terms of the agreement.
No part of this publication may be reproduced, transmitted, or translated in any form or by any means,
electronic, mechanical, manual, optical, or otherwise, without the prior written permission of Sybase, Inc. and
its subsidiaries.
Sybase, Inc. or its subsidiaries claim copyright in this program and documentation as an unpublished work,
revisions of which were first licensed on the date indicated in the foregoing notice. Claim of copyright does
not imply waiver of other rights of Sybase, Inc. and its subsidiaries.
ClearConnect, Column Design, ComponentPack, InfoMaker, ObjectCycle, PowerBuilder, PowerDesigner,
Powersoft, S-Designor, SQL SMART, and Sybase are registered trademarks of Sybase, Inc. and its
subsidiaries. Adaptive Component Architecture, Adaptive Server Anywhere, Adaptive Server Enterprise,
Adaptive Warehouse, AppModeler, DataArchitect, DataExpress, Data Pipeline, DataWindow, dbQueue,
ImpactNow, InstaHelp, Jaguar CTS, jConnect for JDBC, MetaWorks, NetImpact, PowerDynamo, Optima++,
Power++, PowerAMC, PowerBuilder Foundation Class Library, Power J, PowerScript, PowerSite, Powersoft
Portfolio, Powersoft Professional, PowerTips, ProcessAnalyst, Runtime Kit for Unicode, SQL Anywhere, The
Model For Client/Server Solutions, The Future Is Wide Open, Translation Toolkit, UNIBOM, Unilib, Uninull,
Unisep, Unistring, Viewer, WarehouseArchitect, Watcom, Watcom SQL Server, Web.PB, and Web.SQL are
trademarks of Sybase, Inc. or its subsidiaries. Certified PowerBuilder Developer and CPD are service marks
of Sybase, Inc. or its subsidiaries. DataWindow is a patented proprietary technology of Sybase, Inc. or its
subsidiaries.
AccuFonts is a trademark of AccuWare Business Solutions Ltd.
All other trademarks are property of their respective owners.
This document will help you to use and modify definition (DEF) files. The DEF files define target
databases that interface with PowerDesigner.
Contents
Topic
Page
Overview
General Formatting
PowerDesigner Variables
General Macros
10
Field Details
12
Make backup copies of the original DEF files before you make any changes to the DEF files.
Changes to the DEF files will impact how PowerDesigner functions, especially in regard to
generated scripts. Make sure that you thoroughly test generated scripts and backup your database
prior to excuting these scripts.
Overview
This documentation presents a preliminary description of PowerDesigner DEF files.
PowerDesigner uses DEF files to define database-specific capabilities and SQL syntax. The DEF
file is a required component of PowerDesigner when working with Physical Data Models (PDM) or
WarehouseArchitect Models (WAM). Through the use of the DEF file, PowerDesigner ensures that
differences between databases are handled properly. Because each database is different, each
database has its own DEF file.
Each DEF file is made up of a number of sections:
Each section of the DEF file is composed of a series of fields and field values. These fields are
parameters recognizable by PowerDesigner. All of the DEF files have the same structure,
regardless of the target database.
The values for DEF file fields is what varies for each target database. Some fields may not be
found in a DEF file if that function does not apply to the specific target database.
Scope of DEF file control
Although every effort has been made to allow total control of the database generation process
via the DEF files, some database-specific functionalities were impractical to implement via this
structure. These functionalities are hardcoded in the PowerDesigner application and cannot be
controlled via the DEF file.
PowerDesigner reads the DEF file sequentially, from left to right and from top to bottom
The following sections describe general formatting issues that apply to many of the DEF file fields
and then describe each field and the allowable values for all the DEF files.
Some DEF file parameters or variables are not described in this document. The explanations of
specific database parameters and variables, data warehouse parameters and variables, new
generation parameters and variables added for the latest versions of the databases, message
parameters, and trigger parameters and variables are not included here.
$ For information on trigger parameters and variables, see the chapter on triggers and
procedures in the User's Guide for the PowerDesigner module (DataArchitect, AppModeler, or
WarehouseArchitect) that you are using..
General formatting
File format
The DEF file is a text file and can be viewed or modified using any editor that can handle text files.
When saving the file, make sure that you save it as a text file.
Entry syntax
Each DEF file entry has the following syntax:
# comment describing the field
fieldname = field value
# in the first column designates a comment line and terminates the previous entry.
fieldname relates to the keywords recognized by PowerDesigner when reading DEF files. The
fieldname is also called a parameter in this documentation.
field value is the database specific value for this field. Field values may be one of three types:
$ For information on variables and macros, see the section "PowerDesigner variables". For
information on formatting lists for a specific entry, see the section for that entry.
If a value can fit on a single line, you can place it on the same line as the fieldname. If it requires
multiple lines, place the first line on a new line.
Examples
Multi-line value:
# Command for dropping a database.
DropDatabase =
disconnect all;
dbtool drop database '%DATABASE%.db'
Reserved
characters
PowerDesigner has two reserved characters: # to mark the end of a parameter and % used by the
PowerDesigner variables. If you want to use one of these characters in the SQL syntax or in your
customization, it is necessary to double it.
Examples
The remark generated in the script has just two %% at the beginning:
%% Database name: PROJECT
PowerDesigner variables
PowerDesigner allows you to incorporate values from your model into your generated scripts. It
accomplishes this by providing a number of variables, that you can add to a DEF file. These
variables will be replaced with the actual values from your model when the scripts are generated.
PowerDesigner variables are written between percent signs (%), for example:
CreateTable = create table %TABLE%
Variable list
The variables that you can use in the DEF files are listed in the table that follows. If a variable
description indicates that it can be replaced by a name or code, the Use Name or Use Code radio
button selection in the Generation options dialog box determines the actual replacement value.
The evaluation of the variables depends on the parameters and the context. For example, the
%COLUMN% cannot be used in a CreateTablespace parameter, because this variable is only
known in a column parameter context.
Variables that are used in triggers are described in the triggers chapter of your PowerDesigner
User's Guide.
Variable
Description
Example or
comment
%DBMSNAME%
%DATABASE%
Example: PROJECT
%DATE%
Generation date.
Example:
11/12/97 5:57 PM
%PATHSCRIPT%
Example:
C:\PWRS\PD6\Script
%NAMESCRIPT%
Example: crebas.sql
%STARTCMD%
%REMARK%
%COMMENT%
%OID%
Example: 355
%USER%
Example: User
Example: dbo
%OWNERPREFIX%
Example: dbo.
%OLDOWNER%
Example: dbo
%OLDOWNERPREFIX%
Example: dbo.
%TABLESPACE%
Example:
MY_TABLESPACE
%STORAGE%
Example:
MY_STORAGE
%DOMAIN%
Example: IDENTIFIER
%VIEW%
Example:
QUICK_CUSTOMER
%VCODE%
View code
Example:
QUICK_CUSTOMER
%VNAME%
View name
Example: Quick
customer
%VLABL%
View label
%TABLE%
Example: CUSTOMER
%TCODE%
Table code
Example: CUSTOMER
%TNAME%
Table name
Example: Customer
Table label
%NEWTABL%
Example:
NEW_CUSTOMER
%OLDTABL%
Example: CUSTOMER
%COLNLIST%
Example: CUSNUM,
CUSNAME,
CUSADDR, CUSACT,
CUSTEL, CUSFAX
%COLUMN%
Example: CUSNUM
%COLN%
%CCODE%
Column code
Example: CUSNUM
%CNAME%
Example: Customer
number
%CLABL%
Column label
%COLNNO%
Example: 1
%NO%
Example: 1
%DATATYPE%
Example: NUMERIC(5)
%LENGTH%
Column length.
Example: 5
%PREC%
Column precision
Example: 0
%ISPKEY%
Example: YES
%ISMAND%
Example: YES
%NOTNULL%
Example: null
%UNIQUE%
Example: unique
%MINVAL%
Example: 1
%LVAL%
Comment: Same as
%MINVAL%
%MAXVAL%
Example: 2000
%HVAL%
Comment: Same as
%MAXVAL%
%MINMAX%
%DEFAULT%
Example: 1
%DVAL%
Comment: Same as
%DEFAULT%
%DEFAULTCONST%
Example: Default 1
%UNIT%
Example: $
%FORMAT%
Example: ####.##
%ISUPPER%
Example: YES
%ISLOWER%
Example: YES
%IDRDONLY%
Example: YES
%LISTVAL%
Example:
CUSNUM in
(10,20,30,50,100)
%RULES%
Example:
((CUSACT like "BU
[0-9][0-9][0-9][0-9]")
or (CUSACT like
"[MT]C[0-9][0- 9]
[0-9][0-9]"))
%NEWCOLN%
Example:
NEW_CUSNUM
%OLDCOLN%
Example: CUSNUM
%INDEX%
Example:
CUSTOMER_PK
%ASC%
Example: ASC
%ISASC%
Example: YES
%CLUSTER%
%PKEYINDX%
Example: primary
%INDEXTYPE%
Example: btree
%PKEYLIST%
Example: PRONUM,
TSKNAME, EMPNUM
%AKEY%
Example:
CUSTOMER_AKEY1
%REFR%
Example:
SUBCONTRACT
Maximum value
%CONSTNAME%
Example:
PK_CUSTOMER
%CONSTDEFINITION%
Example: check
(CUSNUM between 1
and 2000 and
CUSNUM in
(10,20,30,50,100) and
(CUSNUM != 500))
%PARENT%
Example: CUSTOMER
%CHILD%
Example: PROJECT
Variable macros
Variable macros allow you to perform string manipulation within a variable. They are implemented
by inserting codes into the variable after the initial percent sign. You embed formatting options in
variable syntax as follows:
%.format:variable%
Description
Example
Result
.n:
%.12:CNAME%
.L:
%.L:CNAME%
customer number is
the result for the
Customer Number
column name
.U:
%.U:CNAME%
CUSTOMER
NUMBER is the result
for the Customer
Number column name
.J:
Combined example:
%.20J:CNAME%
Customer Number
(with 5 trailing blanks)
is the result for the
Customer Number
column name
.T:
Combined example:
%.20T:CNAME%
Customer Number is
the result for the
Customer Number
column name (the
blanks added to make
20 characters are all
removed)
.DEFINE "_DEFAULT"
"default(%?DEFAULT%)"
If %DEFAULT% is
null (the default value
field of the check
parameters is empty),
_DEFAULT is empty
* If the ? is not added in the variable definition and if %DEFAULT% is null (the default value field of the check
parameters is empty), _DEFAULT is equal to default(). With the ? character, _DEFAULT is empty.
General macros
Two macros are provided for defining your own variables for use in SQL scripts.
.DEFINE
The .DEFINE command is used to create a new variable and assign a default value to it.
Syntax:
.DEFINE "var_name" "value"
Example:
.DEFINE "TableName" "%USER%.%TABLE%"
drop table %TableName%
This code defines a new variable called Tablename and sets its default value to be the user ID and
the table name separated by a period.
.DEFINEIF
The .DEFINEIF command will conditionally set the value of a previously created variable to a
specified value. The conditional test is for a valid value or a null value. If a valid value is found,
the variable will be set. If a null value is found, the value will not be set. DEF file scripts are
executed from top down, with no branching, setting defaults first and then conditional values.
Syntax :
.DEFINEIF "test_string" " var_name" "value"
Example 1: The following code defines a new variable called Case. Its initial value is nothing.
Then if the %ISUPPER% variable is YES, PowerDesigner will set the value of Case to be
"upper()". It then checks to see if the %ISLOWER% is YES, and if so, sets the value of Case to be
"lower()".
AddColtable =
.DEFINE "_CASE" ""
.DEFINEIF "%ISUPPER%" "_CASE" "upper()"
.DEFINEIF "%ISLOWER%" "_CASE" "lower ()"
%COLUMN% %_CASE%
Alternate method: If you know that the variable can only have one of two values, you can set the
default to one of the values and then only test for the other value.
AddColtable =
.DEFINE "_CASE" "lower()"
.DEFINEIF "%ISUPPER%" "_CASE" "upper()"
%COLUMN% %_CASE%
Example 2: This example uses the sense of the PowerDesigner reading (top down). If any column
has a default value defined in the check parameters, the column definition is followed by
default(defval), where defval is the value defined in the Default value field.
If there is no default value defined in the check parameters and if the column is not a primary key,
the column definition is followed by "with default". If there is no default value defined in the check
parameters and if the column is a primary key, the column definition is followed by nothing.
AddColtable =
.DEFINE "_DEFAULT" "with default"
.DEFINEIF "%ISPKEY%" "_DEFAULT" ""
.DEFINEIF "%DEFAULT%" "_DEFAULT" "default(%?DEFAULT%)"
%COLUMN% %DATATYPE% %_DEFAULT%
10
Note: The _DEFAULT is initialized with "with default". If the column is a primary key,
_DEFAULT is empty. If the column (primary key, foreign key or any other column) has a default
value, _DEFAULT is equal to default(defval).
Example 3: The following macro program comes from the AddColTable parameter of the
TERADATA.DEF file:
AddColTable =
.DEFINE "_LABEL" "title '%?CLABL%'"
.DEFINE "_RANGE" "%?MINVAL% to %?MAXVAL%"
.DEFINE "_DEFAULT" "default(%?DEFAULT%)"
.DEFINE "_FORMAT" "format '%?FORMAT%'"
.DEFINE "_CASE" ""
.DEFINEIF "%?ISUPPER%" "_CASE" "UPPERCASE"
.DEFINE "_COLOPT" "%_LABEL% %_RANGE% %_DEFAULT% %_FORMAT% %_CASE%"
%COLUMN% %DATATYPE% %NOTNULL% %.T:_COLOPT%
11
Field details
Database and target database identification
Header comments
File, Product, Database, and the Sybase Copyright on the first lines are header comments. There
are comment characters # at the beginning of each line.
Product
Description
PowerDesigner tests this field to insure the DEF file is for the product being used. There is a series
of DEF files for each product. DEF files for a particular database will probably be the same for all
products, but this allows us to program different functionality based on the product being used
and/or change the list of supported databases.
Example
Product
= PowerDesigner
Module
Description
When the variable is flagged WarehouseArchitect, the DataArchitect module ignores the DEF file.
The available database interface is listed when generating WAM file from a CDM file (or when
changing the target database from the WAM Dictionary menu).
Example
Red Brick Warehouse and Sybase IQ DEF files have the Module variable set as follows.
Module = WarehouseArchitect
The PDM generation from a DataArchitect CDM does not include RedBrick Warehouse or Sybase
IQ database interface in the available list.
Version
Description
The version defines the major release of PowerDesigner for which this DEF file was intended to
be used. The number of the version will normally change only for major release.
Example
Version
= 6.1
DbmsName
Description
This field represents the name of the database that will appears in the list of target databases. This
list appears when generating a PDM from a CDM, or when changing the target database from the
PDM. The list of the available target databases is constructed by scanning the specified
subdirectory for DEF files and then taking the DbmsName from each file and adding it to the list.
Example 1
If you want to modify the DEF file in order to change the standard parameter setting, you should
copy the standard DEF file that you want to modify, and change the DbmsName in order to
recognize it among databases on the available list.
Example 2
If you create your own Sybase SQL Anywhere DEF file, MYSQLANY.DEF, you could set the
DbmsName field to a new value:
DbmsName = My updated SQLAnyWhere.
Then you will see the value My updated SQLAnyWhere in the list.
12
When you create your own DEF file, in order to see your own DbmsName on the list proposed
on the PDM, you must force PowerDesigner to rebuild its current DbmsName list. You can
either restart PowerDesigner, or from the ? button beside the available list, choose another
directory and click the OK button, then go back to the ? button and choose the real DEF
directory, with your DbmsName in the available list.
Although every effort was made to not hardcode any logic to the DbmsName, there are some cases
where this has occurred. See the section on Hard Coding to see where this has occurred.
DbmsAlias
Description
When hardcoding occurs it is usually based on this value. Many PowerDesigner functions are
based on the value set in this field. These functions are not limited to script generation, but also
control the way that reverse engineering and other functions operate. You should verify that this
value is not changed or you can set it to a value from one of the supplied DEF files.
Example
Terminator
Description
End of command character. This is the characters used to terminate commands. For example, the
create table, view, index, or the the open/close database commands
Example
Terminator = ;
BlockTerminator
Description
End of block character. This character ends the expression of triggers, stored procedures, views,
alter tables, and other SQL request of the modify script.
Example
BlockTerminator = /
UseBlockTerm
Description
Use end of block character. This field makes sense when the BlockTerminator variable has been
set.
Value
Result
Yes
The BlockTerminator character ends all the expressions, including triggers, stored procedures,
views, alter tables, and other SQL requests of modify script
No
View SQL expressions ignore the BlockTerminator character. Other expressions use it
Delimiter
Description
Example
Delimiter = ,
not null,
not null,
not null,
,
,
,
IdxDelimiter
Description
Example
Field separation character for index definition. When the index separation character is different
from the default delimiter defined for other orders, the DEF file mentions the specific field
IdxDelimiter.
DEF file parameter
Delimiter only
The character defined in the Delimiter field will separate index columns
Index columns will not be separated by any field and the Delimiter
character will separate other object fields
KeyDelimiter
Description
This field is specific to Microsoft Access 1.0 and Microsoft Access1.1. This delimiter character is
used between primary key columns on parent table and foreign key columns on child tables to
specify the join when defining an Access reference.
Example
KeyDelimiter = !
AccCreateReference "RELATION_22", "PARTICIPATE", "PRONUM!TSKNAME",
"TASK", "PRONUM!TSKNAME"
Quote
Description
The character that is used to enclose string values. It is usually either a single or double quotation
mark.
Example
Quote = '
SqlContinue
Description
Continuation character. Some databases require a continuation character when commands span
more than a single line. This character, if present, will be appended to each line just prior to the
linefeed.
Example
SqlContinue = +
Rbase needs a character to specify a multiligne sql order:
create table TEAM +
( +
TEANUM
NUMERIC(5)
not null, +
TEASPE
CHARACTER(80)
, +
primary key (TEANUM) +
)
14
lllegalChar
Description
Invalid characters for names. This is only used for generation. The invalid characters for names and
codes are defined in the Model Options dialog box (Name page and Code page, respectively).
Example
DefaultChar
Description
Default character. When PowerDesigner detects an illegal character in a Name or Code defined by
the user, it replaces this character by the default character. This replacement is automatically
applied when you press the = button in a name or code field.
Example
DefaultChar = "_"
MaxScriptLen
Description
Example
MaxScriptLen = 72
In the DB2.DEF, the field is set to 72: DB2 MVS only supports 72 characters per script line.
MaxTableLen
Description
Maximum table code length supported by the target database. This is the maximum number of
characters supported by the database for the naming of the table codes.
The Check Model verifies each table code length and raises an error if the table has a code too long
for the target database.
Maximum length for names and codes:
PowerDesigner has a maximum length of 80 characters for names and codes. If your database
supports longer names, you will be limited by PowerDesigner to 80 characters.
Example
MaxTableLen = 128
MaxIndexLen
Description
Maximum index code length supported by the target database. This is the maximum number of
characters supported by the database for the naming of the index codes.
The Check Model verifies each index code length and raises an error if the index has a code too
long for the target database.
Maximum length for names and codes:
PowerDesigner has a maximum length of 80 characters for names and codes. If your database
supports longer names, you will be limited by PowerDesigner to 80 characters.
Example
MaxIndexLen = 128
MaxColumnLen
Description
Maximum column code length supported by the target database. This is the maximum number of
characters supported by the database for the naming of the column codes.
The Check Model verifies each column code length and raises an error if the column has a code too
long for the target database.
15
PowerDesigner has a maximum length of 80 characters for names and codes. If your database
supports longer names, you will be limited by PowerDesigner to 80 characters.
Example
MaxColumnLen = 128
MaxConstLen
Description
Maximum constraint name length supported by the target database. This is the maximum number of
characters supported by the database for the naming of the constraints.
Maximum length for contraint names:
PowerDesigner has a maximum length of 30 characters for constraint names. If your database
supports longer constraint names, you will be limited by PowerDesigner to 30 characters.
Example
MaxConstLen = 128
MaxColIndex
Description
Maximum number of columns allowed in an index in the target database. The Check Model
verifies and indicates an error if there are more columns included in the index definition than the
allowed number.
Example
MaxColIndex = 99
Header
Description
Script header. Anything added to this entry will be added at the beginning of the generated scripts.
You can place a header in your scripts to document or perform initialization logic.
Example 1
Header =
// PowerDesigner generated creation Script
// Generated from %DATABASE% for %DBMSNAME%
// File generated %NAMESCRIPT%
//
Footer
Description
Script footer. Anything added to this entry will be added at the end of the generated scripts. You
can place a footer in your scripts to document or perform termination logic.
Example
16
CustomItem1
This field is specific to a few non-SQL databases (Microsoft Access 2.0, Access 95, and the Visual
Basic Professional and Enterprise versions). It helps to build the program for the creation of the
database structure.
CustomItem2
This field is specific to a few non-SQL databases (Microsoft Visual Basic Professional and
Enterprise versions). Since each DEF field has a limited length, the database structure program
defined in CustomItem1 field can continue in CustomItem2.
CustomItem3
This field is specific to a few non-SQL databases (Microsoft Visual Basic Professional and
Enterprise versions). Since each DEF field has a limited length, the database structure program
defined in CustomItem2 field can continue in CustomItem3.
CustomItem4
This field is specific to a few non-SQL databases (Microsoft Visual Basic Professional and
Enterprise versions). Since each DEF field has a limited length, the database structure program
defined in CustomItem3 field can continue in CustomItem4.
UpperCaseOnly
Description
Example
Uppercase only. When generating a script from PDM, all objects (tables, columns, constraint,
index, etc.) can have a specific case definition (uppercase, lowercase) different from the one
defined in the PDM and Model Options (uppercase, lowercase, or mixed case).
Value
Result
Yes
No
Generates all script unchanged from the way objects are written in the model (uppercase,
lowercase or mixed case is kept)
UpperCaseOnly = NO
The UpperCaseOnly field is ignored if UpperCaseOnly and LowerCaseOnly fields are both set
to Yes. In this case, PowerDesigner will overwrite UpperCaseOnly with the value of the
LowerCaseOnly field: the script will be generated in lowercase.
LowerCaseOnly
Description
Example
Lowercase only. This controls whether script other than table names and column names are in
lowercase only.
Value
Result
Yes
No
Generates all script unchanged from the way objects are written in the model (uppercase,
lowercase or mixed case is kept)
LowerCaseOnly = NO
17
SQLSupport
Description
Target database
Result
Yes
No specific treatment
No
Example
SQLSupport = YES
EnableTabPar
Description
Example
Result
Yes
No
not null,
not null,
,
not null,
not null,
,
EnableNotNull
Description
18
Target database
Result
Yes
No
Example
not null,
not null,
,
EnableNull
Description
Example
Target database
Result
Yes
No
where CUSACT, CUSTEL, CUSFAX are not mandatory columns, the null keyword is set beside
the column on the create table order.
create table CUSTOMER
(
CUSNUM
numeric(5)
CUSNAME
char(30)
CUSADDR
char(80)
CUSACT
char(80)
CUSTEL
char(12)
CUSFAX
char(12)
constraint PK_CUSTOMER primary key
)
go
not null,
not null,
not null,
null
,
null
,
null
,
(CUSNUM)
EnableNotNullWithDflt
Description
Does the database support Not Null With Default syntax in column definitions.
Value
Target database
Result
Yes
No
Example
19
where the PK Division Number column of the Division table has its Mandatory checkbox and its
With Default checkbox selected, the database generation script is:
create table DIVISION
(
DIVNUM
NUMERIC(5)
not null with efault,
DIVNAME CHAR(30)
not null ,
DIVADDR CHAR(80)
,
constraint PK_DIVISION primary key (DIVNUM)
)
EnableIdentity
Description
Identity key field support. Identity columns are serial counters that the database maintains (Sybase
and Microsoft SQL Server). This will control whether the Identity checkbox on the column
properties window is enabled or not.
When the Identity checkbox is selected, the Identity keyword is generated in the script after the
column data type.
An identity column is always a not null column: when checking the Identity checkbox, the
Mandatory checkbox is automatically selected.
PowerDesigner controls:
Example
Only one identity column can be defined per table: when the identity is set for a column, other
columns of the table have their identity checkbox grayed
A foreign key cannot be an identity column: the checkbox is grayed
Identity is only supported by certain data types . When the Identity checkbox is selected for a
column which data type does not match with identity, the data type is automatically changed to
numeric. When the data type of an identity column is replaced by a data type that does not
match with identity, PowerDesigner displays the error message "Identity cannot be used with
the selected data type"
identity,
null
,
not null,
null
,
not null,
null
,
null
,
(EMPNUM)
EnableOption
Description
20
Physical options allowed in target database (model, table, index, alternate key, etc.). This applies
for exemple to database, tables, indexes, alternate keys. It also controls whether or not the Options
button on the object Properties is enabled or not.
Example
Value
Target database
Result
Yes
No
EnableOption = YES
EnableIntegrity
Description
Example
Integrity constraints allowed. This controls whether the referential integrity checkboxes (for
primary, foreign, and alternate keys) in the database parameters window (for generation and
modification) are grayed or available.
Value
Result
Yes
Referential integrity checkboxes are available for database generation and modification
No
Referential integrity checkboxes are grayed for database generation and modification
EnableIntegrity = YES
EnablePrimKey
Description
Primary key allowed. This entry controls whether the Primary key option is enabled on the
Generate and Modify database windows.
Example
EnablePrimKey = YES
EnableFornKey
Description
Foreign key allowed. This entry controls whether the Foreign key option is enabled on the Generate
and Modify database windows.
Example
EnableFornKey = YES
EnableFkeyName
Description
Result
Yes
The foreign key constraint is generated with a specific name. This name is defined in the
DEF file with the constraint name template FKConstraintName
By default, the foreign key constraint name is FK_%OID%. It can be no longer than 8
characters
No
Example 1
The foreign key is generated without any specific name for the foreign key constraint
21
where the column Division number (DIVNUM) is a foreign key of the Employee (EMPLOYEE)
table and the foreign key constraint name is FK_345:
alter table EMPLOYEE
foreign key FK_345 (DIVNUM)
references DIVISION on delete restrict;
Example 2
where the foreign key does not have any constraint name:
alter table EMPLOYEE
foreign key (DIVNUM)
references DIVISION on delete restrict;
Example 3
The DEF variable EnableConstName has the same purpose as EnableFKeyName, extended to all
the constraints (primary, foreign, alternate keys, column and table constraints). If the DEF file uses
the two variables, the one set to YES will overwrite the other one.
EnableFKeyName = YES
EnableConstName = NO
The foreign key constraint name is generated. Other constraint names for primary keys, alternate
keys, and table and column checks, will not be generated.
EnableFKeyName = NO
Example 4
EnableConstName = YES
The foreign key constraint name is also generated. Other constraints will also be generated
PkInTable
Description
Example
Primary key created in table. This entry determines where primary keys will be defined in the SQL
script.
Value
Result
Yes
No
PkInTable = YES
FkInTable
Description
Example
Foreign key created in table. This entry determines where in the SQL script Foreign keys will be
defined.
Value
Result
Yes
No
FkInTable = NO
PKAutoIndex
Description
22
Primary key is auto-indexed. This option primarily determines whether to generate a Create Index
statement for every Primary key statement.
Value
Target database
Result
Yes
Automatically generates a
primary key index when
generating the primary key
statement
No
Example
If you select the primary key checkbox under create index, the
primary key checkbox of the create table will automatically be
cleared, and vice versa
FKAutoIndex
Description
Foreign key is auto-indexed. This option primarily determines whether to generate a Create Index
statement for every Foreign key statement.
Value
Target database
Result
Yes
Automatically generates a
foreign key index when
generating the primary key
statement
No
Example
If you select the foreign key checkbox under create index, the
primary key checkbox of the create table will automatically be
cleared, and vice versa
EnableUniqConst
Description
Example
Target database
Result
Yes
No
23
If the alternate key {Division name (DIVNAME), Division number (DIVNUM)} has been defined
in the Division table, the create table includes the unique clause on those two columns:
create table DIVISION
(
DIVNUM
integer
DIVNAME
char(30)
DIVADDR
char(80)
primary key (DIVNUM),
unique (DIVNAME, DIVNUM)
);
not null,
not null,
,
EnableUserType
Description
Example
Result
Yes
The User-defined type checkbox for columns is available in the database generation and
modification parameters
No
EnableUserType = YES
MaxUserTypeLen
Description
Example
MaxUserTypeLen = 30
UserTypeName
Description
Example
UserTypeName = T_%DOMAIN%
AddQuote
Description
Specifies whether PowerDesigner should place quote marks around table and column names.
Example
Tables and Columns in database generation script are defined between quotes:
newTab = create "DIVISION" as "Paradox" with
"DIVNUM"
: "N",
"DIVNAME"
: "A30",
"DIVADDR"
: "A80"
endCreate
EnableDefault
Description
Default allowed.
Value
Result
Yes
The default value is generated for each column whether or not the default value is defined.
The default value can be defined in the check parameters for each column.
The Default Value checkbox for columns must be selected in the database generation and
modification parameters windows
No
24
The Default Value checkbox in the database generation and modification parameters
windows is grayed. The default value cannot be generated
Example
where the default value for the column employee function (EMPFUNC) is Technical Engineer, the
generated script will be:
create table EMPLOYEE
(
EMPNUM
numeric(5)
not null,
EMP_EMPNUM numeric(5)
,
DIVNUM
numeric(5)
not null,
EMPFNAM
char(30)
,
EMPLNAM
char(30)
not null,
EMPFUNC
char(30)
default 'Technical Engineer',
EMPSAL
numeric(8,2)
,
primary key (EMPNUM)
);
DefaultAtEnd
Description
The column default value is generated after the data type and the NULL/NOT NULL statement, at
the end of the column definition. YES/NO.
Example 1
The default value of the column Division number (DIVNUM) is generated after the NOT NULL
statement:
create table DIVISION
(
DIVNUM
numeric(5)
DIVNAME char(30)
DIVADDR char(80)
primary key (DIVNUM)
);
Example 2
The default value of the column DIVNUM is generated before the NOT NULL statement:
create table DIVISION
(
DIVNUM
numeric(5)
DIVNAME char(30)
DIVADDR char(80)
constraint PK_DIVISION primary
)
ReservedDefault
Description
The ReservedDefault variable lists all the database reserved default values that PowerDesigner
must keep as database keywords. PowerDesigner will not add quotes between them. (Column
default values are defined in the column Check Parameters.)
Example
ReservedDefault =
NULL
AUTOINCREMENT
CURRENT DATE
CURRENT PUBLISHER
CURRENT TIME
CURRENT TIMESTAMP
CURRENT USER
USER
25
AUTOINCREMENT,
Other DEF files, like SYSTEM11.DEF, for databases that do not support AUTOINCREMENT as
a reserved word, it will be generated between quotes:
create table DIVISION
(
DIVNUM
numeric default 'AUTOINCREMENT' not null,
DIVNAME char(30) not null,
DIVADDR char(80) null
,
constraint PK_DIVISION primary key (DIVNUM)
)
go
MaxDefaultLen
Description
Maximum length that the database supports for the name of the column Default name. This name is
only defined in the Sybase databases family syntax.
Example
MaxDefaultLen = 30
UddtDefaultName
Description
Name of the user data types Default name. When a domain has a specific default value defined in
its check parameters, Sybase databases create a name for this user data type default value.
Example
The FunctionList domain has a default value defined in its check parameters: Technical Engineer.
The following SQL order will generate a default name for that default value:
create default D_Functionlist
as 'Technical Engineer'
go
ColnDefaultName
Description
The column default value is defined in the create table for Sybase SQL Server 4.x and Microsoft
SQL Server. When a column has a specific default value defined in its check parameters, these
databases create a name for this column default value.
Example
The column Employee function (EMPFUN) of the table Employee has the default value, Technical
Engineer. The column default name, D_EMPFUNC_EMPLOYEE, will be created:
create default D_EMPFUNC_EMPLOYEE
as 'Technical Engineer'
go
execute sp_bindefault D_EMPFUNC_EMPLOYEE, "EMPLOYEE.EMPFUNC"
go
26
EnableCheck
Description
Example
Result
Yes
No
The column and table Check checkboxes are grayed in the database generation and
modification parameters windows. Columns and tables checks are not generated
The Project number (PRONUM) column value must be defined between 1 and 17.
The Start date (PROBEG) column value must be smaller than the End date (PROEND)
column value.
create table PROJECT
(
PRONUM
integer
not null
check (
PRONUM between 1 and 17),
CUSNUM
integer
not null,
EMPNUM
integer
,
PRONAME char(30)
not null,
PROLABL char(80)
,
PROBEG
timestamp
,
PROEND
timestamp
,
primary key (PRONUM),
check (
PROJECT.PROBEG < PROJECT.PROEND)
);
Check parameters
Check includes all checks parameters defined in the table or column default or additional
validation rules. It does not take into account the column default value which is treated
separately in the EnableDefault field.
CheckNull
Description
When a column is not mandatory and has check parameters defined, it explicitly verifies if a
column is NULL in the column check of the generated SQL order.
Example
The Employee number (EMPNUM) is an optional column on Project table. This column has a
validation rule: the employee number column value must be defined between 1 and 99999.
The column check includes a control for the possibility of a Null value in the validation rule.
create table PROJECT
(
PRONUM
integer
not null,
CUSNUM
integer
not null,
EMPNUM
integer
check (
EMPNUM is null or (EMPNUM between 1 and 99999)),
PRONAME char(30)
not null,
PROLABL char(80)
,
PROBEG
timestamp
,
PROEND
timestamp
,
primary key (PRONUM),
);
27
MaxRuleLen
Description
Maximum length that the database supports for the table or column Rule name. This name is only
defined in the Sybase databases family syntax.
Example
MaxDefaultLen = 30
UddtRuleName
Description
Name of the user data types Rule name. When a domain has a specific rule defined in its check
parameters, the Sybase databases family creates a name for this user data type rule value.
Example
The Domain_speciality domain, has to belong to a set of values. This domain check has been
defined in a validation rule. The SQL order will generate the rule name following the template
defined in the field UddtRuleName:
create rule R_Domain_speciality
as
(@Domain_speciality in
('Industry','Military','Nuclear','Bank','Marketing'))
go
execute sp_bindrule R_Domain_speciality, T_Domain_speciality
go
ColnRuleName
Description
The column check parameters are defined, in separate rules, in the create table for Sybase SQL
Server 4.x and Microsoft SQL Server. When a column has a specific rule defined in its check
parameters, these databases create a name for this column rule.
Example
The column Speciality (TEASPE) of the table Team has a list of values defined in its check
parametres: Industry, Military, Nuclear, Bank, Marketing.
The following rule name, R_TEASPE_TEAM, will be created and associated with the TEASPE
column:
create rule R_TEASPE_TEAM
as
@TEASPE in
('Industry','Military','Nuclear','Bank','Marketing')
go
execute sp_bindrule R_TEASPE_TEAM, "TEAM.TEASPE"
go
EnableConstName
Description
28
Value
Result
Yes
The constraints will be generated with the constraint name if the associated object
generation is supported by the target database
No
Example1
Primary key constraint name will be generated, with the name defined in the
PKConstraintName field, if the EnablePrimKey is set to YES
Foreign key constraint name will be generated, with the name defined in the
FKConstraintName field, if the EnableFornKey is set to YES
Alternate key constraint name will be generated, with the name defined in the
FKConstraintName field, if the EnableUniqConst is set to YES
Column and table check constraint will be generated with the name defined in the
CKCConstraintName and CKTConstraintName fields, if the EnableCheck is set to YES
Constraint will be generated, without the constraint name defined in PowerDesigner, if they
are supported by the target database
The check on Speciality (TEASPE) column is generated with the specific name
CKC_TEASPE_TEAM:
create table TEAM
(
TEANUM int
not null,
TEASPE char(10)
null
constraint CKC_TEASPE_TEAM check (TEASPE in
('Industry','Military','Nuclear','Bank','Marketing')),
constraint PK_TEAM primary key (TEANUM)
)
go
Example2
The check on Speciality (TEASPE) column is generated without any specific name:
create table TEAM
(
TEANUM integer
not null,
TEASPE char(10)
check (TEASPE is null or (TEASPE in
('Industry','Military','Nuclear','Bank','Marketing'))),
primary key (TEANUM)
);
UniqConstName
Description
UNIQUE constraint allowed for tables on the database. This is not implemented yet, but added in
the DEF file to prepare future enhancements that can be managed in the Check Model.
Value
Result
Yes
The constraint names must be unique in the entire database. For example, two tables cannot
have the same primary key constraint name
No
Constraint names include primary key, foreign key, alternate key, and table and column checks.
Example
UniqConstName = NO
29
ConstNameAtEnd
Description
Example 1
The primary key constraint name PK_TEAM is at the end of the primary key definition:
create table TEAM
(
TEANUM INTEGER
not null,
TEASPE CHAR(10)
primary key (TEANUM) constraint PK_TEAM,
);
Example 2
The primary key constraint name PK_TEAM is at the beginning of the primary key definition:
create table TEAM
(
TEANUM int
not null,
TEASPE char(10)
null
constraint PK_TEAM primary key (TEANUM),
)
go
PKConstraintName
Description
This field allows you to declare a customizable template for all the primary key constraint names of
a PDM.
For each table in a model, the primary key constraint name is defined in the table properties field
Primary Key Constraint Name. This constraint name will be generated in the database if the
database supports primary keys and constraint names (see the DEF variables EnablePrimKey and
EnableConstName).
Some PowerDesigner variables can be used to define the primary key constraint name:
Example
%OID%
: table oid
PKConstraintName = PK_%.U27:TABLE%
FKConstraintName
Description
This field allows you to declare a customizable template for all the foreign key constraint names of
a PDM. This constraint name will be generated in the database if the database supports foreign
keys and constraint names (see the DEF variables EnableFornKey and EnableConstName, and for
the SQLBASE6.DEF, EnableFKeyName).
Some PowerDesigner variables can be used to define the foreign key constraint name :
Example
30
%OID%
%REFR%
%NO%
: reference oid
: reference code
: reference number (between two tables)
FKConstraintName = FK_%.U8:CHILD%_%.U9:REFR%_%.U8:PARENT%
To ensure that you will not have two identical constraint names through the model, you can use
the OID or NO numbers inside the template.
For example: FKConstraintName = FK_%.U20:REFR%_%OID% if you use a database, where
the constraint name is unique through the database, or FKConstraintName =
FK_%.U20:REFR%_%NO% if you use a database where the constraint name should be unique
for a table.
AKConstraintName
Description
This field allows you to declare a customizable template for all the alternate key constraint names
of a PDM. The alternate key constraint name is defined at the table level (Alt. Keys button in the
table properties field, Constraint Name).
This constraint name is generated in the database if the database supports alternate keys and
constraint names (see the DEF variables EnableUniqConst and EnableConstName). Some
PowerDesigner variables can be used to define the alternate key constraint name:
Example
%OID%
: ak oid
%AKEY% : ak name
%TABLE% : table code
%NO%
: ak number
AKConstraintName = AK_%.U18:AKEY%_%.U8:TABLE%
CKCConstraintName
Description
This field allows you to declare a customizable template constraint name for column check
parameters, including standard check parameters and validation rules. Column check constraints
are defined at the column level (Check button in the column properties field, Constraint Name).
This constraint name is generated in the database if the database supports column checks and
constraint names (see the DEF variables EnableCheck and EnableConstName). Some
PowerDesigner variables can be used to define the column check constraint name:
Example
%OID%
: column oid
%COLN%
: column code
: column number
CKCConstraintName = CKC_%.U17:COLN%_%.U8:TABLE%
CKTConstraintName
Description
This field allows you to declare a customizable template constraint name for table check
parameters. Table check constraints are defined at the table level (Check button in the table
properties field, Constraint Name).
This constraint name is generated in the database if the database supports table checks and
constraint names (see the DEF variables EnableCheck and EnableConstName). Some
PowerDesigner variables can be used to define the table check constraint name:
Example
%OID%
: table oid
CKTConstraintName = CKT_%.U26:TABLE%
31
EnableIndex
Description
Example
Index allowed.
Value
Target database
Result
Yes
No
EnableIndex = YES
EnableIndPar
Description
Example
Result
Yes
No
Enumeration of the columns that compose the index is defined without parenthesis
The table TASK has a primary key index composed of two columns: Project number (PRONUM)
and Task name (TSKNAME).
create unique index PK_TASK on TASK (PRONUM asc, TSKNAME asc);
EnableUnique
Description
Example
Result
Yes
No
The unique clause is not included when generating an index, even if it has been defined as
unique in PowerDesigner
EnableUnique = YES
EnableCluster
Description
Result
Yes
No
32
The clustered clause is not included when generating an index, even if it has been defined
as clustered in PowerDesigner
Example
A clustered index has been created on table Customer,including the three columns Customer
activity (CUSTACT), Customer number (CUSTNUM), Customer name (CUSTNAME):
create clustered index CUSTOMER_CLUSTER on CUSTOMER (CUSACT, CUSNUM, CUSNAME)
go
EnableAscDesc
Description
Example
ASC, DESC keywords allowed on index definition. Ascending or descending sorting is selected in
the index definition part. By default, the radio button is set on ascending sort.
Value
Target database
Result
Yes
No
When creating the primary key index on table Task, ascending sort has been choosen for column
Project number (PRONUM) and descending sort for column Task name (TSKNAME)
create index PK_TASK on TASK (PRONUM asc, TSKNAME desc);
EnableAlter
Description
Example
Alter table command allowed in the database. By default, the EnableAlter value is YES, and it can
be omitted in the DEF file.
Value
Target database
Result
Yes
No
In the SQLANY55.DEF file, when the alter statement is available, the Team table modification
(addition of the column Team Name) can be integrated in an alter table statement script:
alter table TEAM
add
TEANAME
character(30)
not null
UniqIndxName
Description
Result
Yes
Two table cannot have the same index name. The check model displays an error if different
indexes with same name or same code belong to the model
No
Each index name must be unique for a table, but two indexes can have the same name or
code in two different tables
33
Example
AlterAddConst
Description
Example 1
Add the Constraint keyword on foreign key creation in the alter table command when generating
the database.
Value
Result
Yes
The foreign key constraint is created in the alter table, with the Constraint keyword
explicitly included
No
The foreign key constraint is created in the alter table, without the Constraint keyword
Script example obtained checking the foreign key checkbox of the table Project without checking
the create table checkbox, in the database generation parameters window:
alter table PROJECT
add constraint (foreign key (CUSNUM)
references CUSTOMER (CUSNUM) constraint FK_SUBCONTRA_186);
Example 2
Script example obtained checking the foreign key checkbox of the table Project without checking
the create table checkbox, in the database generation parameters window:
alter table PROJECT
add (foreign key (CUSNUM)
references CUSTOMER (CUSNUM) constraint FK_SUBCONTRA_186);
EnableMultiFile
Description
Multi-script allowed. This variable acts on the availability of the One File Only checkbox in the
Generate database, Generate Triggers and Procedures, and Modify Database parameters windows.
Value
Result
Yes
The One File Only checkbox is available, one script will be created for each table, and a
general script will sum up all the single table script entries. Each single script has the table
name and the extension defined in TableExt DEF variable
The general script has the file extension described in the DEF variable ScriptExt, and its
name is customizable in the File Name field of the generation or modification parameters
windows. The default names are CREBAS for database generation, CRETRG for triggers
and procedures generation, and ALTER for database modification
No
The One File Only checkbox is grayed, and a unique script will include all the orders
The file extension is described in the DEF variable ScriptExt, and its name is customizable
in the File Name field of the generation or modification parameters window. The default
names are CREBAS for database generation, CRETRG for triggers and procedures
generation, and ALTER for database modification
Example
EnableMultiFile = YES
ScriptExt
Description
34
When generating the database or the triggers and procedures, when modifying the database, the
DEF variable ScriptExt defines the main script extension.
Example
ScriptExt = sql
TableExt
Description
When generating a database or triggers and procedures, or when modifying the database, without
checking One File Only checkbox, one script is generated for each table, with the file extension
defined in the DEF variable TableExt (see also EnableMultiFile).
Example
TableExt = sql
ReverseExt
Description
When reverse engineering a database using a script file, the DEF variable ReverseExt defines the
script extension. The file selection window allows you to choose a script file to reverse if its Files
of Type field has the type defined in the ReverseExt DEF variable.
The ReverseExt variable is only defined for databases for which the reverse script extension is not
identical to the generation script extension defined in the ScriptExt DEF variable, for example,
ACCESS95.DEF or AS400.DEF.
For other databases, the ScriptExt DEF variable is taken into account both for generation and
reverse.
Example
ReverseExt = sql
Table and Index header. Anything added to this entry will be added before the title of the Create
Table statement. You can place a table header in your scripts to document or perform initialization
logic.
Example
TabIdxFooter
Description
Table and index footer. Anything added to this entry will be added after the last Create Index
statement of each table.
Example
TableHeader
Description
Table header. Anything added to this entry will be added before the Create Table statement and
after the table begin script. You can place a table header in your scripts to document or perform
initialization logic.
Example
TableHeader =
set quoted_identifier on
go
TableFooter
Description
Table footer. Anything added to this entry will be added after the physical options of the Create
Table statement and before the terminator. The end script is generated after the terminator of the
Create Table statement.
Example
IndexHeader
Description
Index header. Anything added to this entry will be added before the Create Index statement. You
can place an index header in your scripts to document or perform initialization logic.
Example
IndexFooter
Description
Table footer. Anything added to this entry will be added after the physical options of the Create
Index statement and before the terminator.
Example
AlterHeader
Description
Example
Alter script header. Anything added to this entry will be added at the beginning of the database
modification script. You can place a header in your scripts to document or perform initialization
logic.
AlterHeader =
/* Company: SYBASE */
/* Software: PowerDesigner DataArchitect */
AlterFooter
Description
Alter script footer. Anything added to this entry will be added at the end of the database
modification script. You can place a footer in your scripts to document or perform termination
logic.
Example
Example
AlterFooter = /* End of modification script */
AlterTableHeader
Description
Alter table header. Anything added to this entry will be added before the Alter Table statement.
You can place an alter table header in your scripts to document or perform initialization logic.
Example
36
AlterTableFooter
Description
Alter table footer. Anything added to this entry will be added after the Alter Table statement and
before the terminator.
Examples
A statement can be defined on a single line. In this case the statement syntax is entered just after
the = sign, on the same line as the parameter, as follows:
CreateTablespace = create dbspace %TABLESPACE%
Multi-line statement
A statement can also be defined on multiplelines. In this case, the statement syntax is entered on a
new line, as follows:
CreateDatabase =
dbtool create database %DATABASE%.db
transaction log to %DATABASE%.log
Empty parameters
If the parameter is empty (equal to nothing), the target database does not support the corresponding
SQL statement. An empty parameter has an impact on the user interface: the corresponding
checkbox in the Generate Database and Modify Database windows can be grayed.
Evaluation of
variables
The syntax entered by the user for these parameters must be the same as the syntax described in the
database SQL reference manual. In addition, PowerDesigner variables can be used in the statement
definition. PowerDesigner variables have surrounding % marks.
The evaluation of the variables depends on the parameters and the context. For example, the
%COLUMN% cannot be used in a CreateTablespace parameter, because this variable is only
known in a column parameter context.
The macros .DEFINE and .DEFINEIF and the variable macros can be used in these parameters.
The generation of the column and table check parameters, the unique constraint, the primary key
constraint, the foreign key constraint cannot be customized via the DEF file for the moment.
$ For more information, see the General formatting section, beginning on page 3.
Command for executing a script. This parameter is special. It corresponds to the %STARTCMD%
variable. The value of this variable depends on this parameters. The start command corresponds to
the command used by the target database to execute a SQL script.
Example
Remark
Description
Command for remarks. If the Add titles checkbox is selected in the Generation Options window,
this parameter generates comments before each important create statement.
Example
BeforeCreateDatabase
Description
This is a boolean parameter. It is equal to YES or NO. YES means that the Create Tablespace
statements and the Create Storage statements are generated before the Create Database statement.
NO means that the Create Tablespace statements and the Create Storage statements are generated
after the Create Database statement. The default value for this parameter is YES.
Example
CreateTablespace
Description
Command for creating a tablespace. If this parameter is empty, the Create Tablespace checkbox on
the Database page of the Generate Database window is grayed.
Example
The %TABLESPACE% variable is the name or code of the tablespace defined in the List of
Tablespaces window.
DropTablespace
Description
Command for dropping a tablespace. If this parameter is empty, the Drop Tablespace checkbox on
the Database page of the Generate Database window is grayed.
Example
The %TABLESPACE% variable is the name or code of the tablespace defined in the List of
Tablespaces window.
CreateStorage
Description
Command for creating a storage. If this parameter is empty, the Create storage checkbox in the
Database tab of the Generate database window is grayed.
Example
The %STORAGE% variable is the name or code of the storage defined in the List of Storages
window.
DropStorage
Description
Command for dropping a storage. If this parameter is empty, the Drop storage checkbox in the
Database tab of the Generate database window is grayed.
Example
The %STORAGE% variable is the name or code of the storage defined in the List of Storages
window.
CreateDatabase
Description
38
Command for creating a database. If this parameter is empty, the Create Database checkbox on the
Database page of the Generate Database window is grayed.
Example
The %DATABASE% variable is the name or code of the model defined in the Model property
sheet.
OpenDatabase
Description
Command for opening a database. If this parameter is empty, the Open Database checkbox on the
Database page of the Generate Database window is grayed.
Example
The %DATABASE% variable is the name or code of the model defined in the Model property
sheet.
CloseDatabase
Description
Command for closing a database. If this parameter is empty, the Close Database checkbox on the
Database page of the Generate Database window is grayed.
Example
DropDatabase
Description
Command for dropping a database. If this parameter is empty, the Drop Database checkbox on the
Database page of the Generate Database window is grayed.
Example
The %DATABASE% variable is the name or code of the model defined in the Model property
sheet.
CreateUserType
Description
Command for creating a user-defined data type or domain. If this parameter is empty, the Create
Data Type checkbox and the associated Check checkbox on the Database page of the Generate
Database window is grayed.
The user-defined data type definitions are hardcoded for Sybase System 10 and System 11, and for
Microsoft SQL Server, because of the identity constraint and the specific NULL/NOT NULL
management.
Example
The %DOMAIN% variable is the name or code of the domain defined in the List of Domains
window. %DATATYPE% is the data type of the domain, %NOTNULL% is NULL or NOT
NULL, depending on the Mandatory option state of the domain.
39
DropUserType
Description
Command for dropping a user-defined data type or domain. If this parameter is empty, the Drop
Data Type checkbox on the Database page of the Generate Database window is grayed.
The user-defined data type definition are hardcoded for Sybase System 10 and System 11, and for
Microsoft SQL Server, because of the identity constraint and the specific NULL/NOT NULL
management.
Example
The %DOMAIN% variable is the name or code of the domain defined in the List of Domains
window.
CreateTable
Description
Examples
The %TABLE% variable is the name or code of the table defined in the List of Tables window or
in the Table property sheet.
AddColTable
Description
Command for adding a column in the Create table statement. This parameter defines the lines of
the Create Table statement. One line corresponds to a column definition.
There is no specific variable for the check parameters. If the database supports the check constraint
(EnableCheck=Yes), they are systematically added after the AddColTable parameter, .
This parameter can be customized. See the General Macro paragraph for more information.
Example
%COLUMN% is the name or code of the column defined in the column list of the table,
%DATATYPE% is the data type of the column, %NOTNULL% is NULL or NOT NULL
depending on the Mandatory option state of the column.
TableComment
Description
Command for adding a table comment. The table comment is a SQL statement. It is not supported
by all RDBMS. If this parameter is empty, the Comment checkbox in the Create Table fields of the
Schema page of the Generate Database window is grayed.
Example
The %TABLE% variable is the name or code of the table defined in the List of Tables window or
in the Table property sheet. The %COMMENT% variable is the label defined in the Label field of
the table.
40
ColumnComment
Description
Command for adding a column comment. The column comment is a SQL statement. It is not
supported by all RDBMS. If this parameter is empty, the Comment checkbox of the Columns group
on the Schema page of the Generate database window is grayed.
Example
The %COLUMN% variable is the name or code of the column defined in the column list of the
table. The %COMMENT% variable is the label defined in the Label field of the column.
DropTable
Description
Command for dropping a table. If this parameter is empty, the Drop table checkbox on the Schema
page of the Generate Database window is grayed.
Example
The %TABLE% variable is the name or code of the table defined in the List of views window or in
the table property sheet.
CreateIndex
Description
Example
The %INDEX% variable is the name or code of the index defined in the List of Indexes window or
in the index list of a table.
AddColIndex
Description
Command for adding a column in the Create Index statement. This parameter defines each column
in the column list of the Create Index statement.
Example
%COLUMN% is the name or code of the column defined in the column list of the table. %ASC%
is ASC or DESC depending on the Sort radio button state for the index column.
DropIndex
Description
Command for dropping an index. If this parameter is empty, the Drop Index checkbox on the
Schema page of the Generate Database window is grayed.
41
Example
The %INDEX% variable is the name or code of the index defined in the List of Indexes window or
in the index list of a table.
Cluster
Description
Cluster keyword. If this parameter is empty, the default value of the %CLUSTER% variable is
CLUSTER.
Example
IndexType
Description
Parameter to create a combination box in the index list of a table. Each index type must be entered
on a new line. If this parameter is empty, the combination box, called Type, in the index list of the
table is not available.
Example
DefIndexType
Description
Default index type. This variable corresponds to one type only. This type must be listed in the
previous IndexType list. If no other type has been selected, this type is the default type of all the
indexes. If this parameter is empty, the default type of the index is (None).
Example
CreateView
Description
Command for creating a view. If this parameter is empty, the Create View checkbox on the Schema
page of the Generate Database window is grayed.
Example
The %VIEW% variable is the name or code of the view defined in the List of Views window or in
the View property sheet.
DropView
Description
42
Command for dropping a view. If this parameter is empty, the Drop View checkbox on the Schema
page of the Generate Database window is grayed.
Example
The %VIEW% variable is the name or code of the view defined in the List of Views window or in
the View property sheet.
ViewComment
Description
Command for adding a view comment. The view comment is a SQL statement. It is not supported
by all RDBMS. If this parameter is empty, the Comment checkbox of the Views group on the
Schema page of the Generate Database window is grayed.
Example
The %VIEW% variable is the name or code of the view defined in the List of Views window or in
the View property sheet. The %COMMENT% variable is the label defined in the Label field of the
view.
ViewCheck
Description
Option for checking a view. This parameter depends on the With Check Option checkbox of the
view property sheet. If the checkbox is selected and if the ViewCheck parameter is not empty, the
value of ViewCheck is generated at the end of the view select statement and before the terminator.
Example
Commit
Description
Command for the validation by OBDC. This command is generated at the end of the ODBC script
to validate the SQL orders.
Example
Command for renaming a table. This parameter is used in the database modification script when a
table has been renamed. If RenameTable is empty, the modify database process drops the foreign
key constraints, creates a new table with the new name, inserts the rows from the old table in the
new table, and creates the indexes and constraints on the new table.
43
Example
The %OLDTABLE% variable is the name or code of the table defined in the List of Tables
window or in the Table property sheet before its renaming. The %NEWTABLE% variable is the
new name or code of the table defined in the List of Tables window or in the Table property sheet.
RenameColumn
Description
Command for renaming a column. This parameter is used in the database modification script when
a column has been renamed. The rename column statement defined in this parameter is a specific
SQL statement different from the alter table statement. It is not supported by all RDBMS.
If the rename column statement is an alter table statement, it must be defined in the
AltRenameColumn parameter. If RenameColumn is empty, the modify database process reads the
AltRenameColumn parameter.
Example
The %OLDCOLN% variable is the name or code of the column defined in the column list window
of a table before its renaming. The %NEWCOLN% variable is the new name or code of the
column defined in the column list of the table.
AddColumn
Description
Command for adding a column. This parameter is used in the database modification script when a
column has been added in the table. The add column statement defined in this parameter is a
specific SQL statement different from the alter table statement. It is not supported by all RDBMS.
If the add column statement is an alter table statement, it must be defined in the AltAddColumn
parameter. If AddColumn is empty, the modify database process reads the AltAddColumn
parameter.
Example
ModifyColumn
Description
Command for modifying a column. This parameter is used in the database modification script when
the column definition has been modified. The modify column statement defined in this parameter is
a specific SQL statement different from the alter table statement. It is not supported by all
RDBMS.
If the modify column statement is an alter table statement, it must be defined in the
AltModifyColumn parameter. If ModifyColumn is empty, the modify database process reads the
AltModifyColumn parameter
Example
DropColumn
Description
44
Command for dropping a column. This parameter is used in the database modification script when
a column has been deleted in the table. The drop column statement defined in this parameter is a
specific SQL statement different from the alter table statement. It is not supported by all RDBMS.
If the drop column statement is an alter table statement, it must be defined in the AltDropColumn
parameter. If DropColumn is empty, the modify database process reads the AltDropColumn
parameter.
Example
AlterTable
Description
Command for modifying a table. This parameter is the first part of the alter table statement. The
other parts depend on the actions: deletion, addition, modification and the object to which the
action is applied.
Other parameters (AltRenameColumn, AltAddColumn, AltDropColumn, AltModifyColumn,
AltModifyColnNull, AltModifyColnDflt, AltModifyColnChk, AltDropPrimKey, AltDropFornKey,
AltDropColnChk, AltDropTablChk, AltDropUnique) allow you to define these actions.
Example
The %TABLE% variable is the name or code of the table defined in the List of Tables window or
in the Table property sheet.
AltRenameColumn
Description
Command for renaming a column in an alter table statement. This parameter is used in the database
modification script when a column has been renamed.
If AltRenameColumn is empty, the modify database process drops the foreign key constraints;
creates a temporary table with the same structure and columns as the table before the column
renaming; inserts the rows from the old table to the new temporary table; drops the actual table;
creates a new table with the renamed column; inserts the rows from the temporary table to the new
table; then creates the indexes and constraints on the new table.
Example
The %OLDCOLN% variable is the name or code of the column defined in the column list window
of a table before its renaming. The %NEWCOLN% variable is the new name or code of the
column defined in the column list of the table.
AltAddColumn
Description
Command for adding a column in an alter table statement. This parameter is used in the database
modification script when a column has been added in the table.
If AltAddColumn is empty, the modify database process drops the foreign key constraints; creates a
temporary table with the same structure and columns as the table before the column addition;
inserts the rows from the old table to the new temporary table; drops the actual table; creates a new
table with the added column; inserts the rows from the temporary table to the new table; then
creates the indexes and constraints on the new table.
Example
The %COLUMN% variable is the name or code of the column defined in the column list window
of a table. The %DATATYPE% variable is the data type of the new column.
45
AltModifyColumn
Description
Command for modifying a column in an alter table statement. This parameter is used in the
database modification script when the column definition has been modified in the table.
If AltModifyColumn is empty, the modify database process drops the foreign key constraints;
creates a temporary table with the same structure and columns as the table before the column
modification; inserts the rows from the old table to the new temporary table; drops the actual table;
creates a new table with the modified column; inserts the rows from the temporary table to the new
table; then creates the indexes and the constraints on the new table.
Example
The %COLUMN% variable is the name or code of the column defined in the column list window
of a table. The %DATATYPE% variable is the data type of the modified column.
AltDropColumn
Description
Command for dropping a column in an alter table statement. This parameter is used in the database
modification script when the column definition has been deleted in the table.
If AltDropColumn is empty, the modify database process drops the foreign key constraints; creates
a temporary table with the same structure and columns as the table before the column deletion;
inserts the rows from the old table to the new temporary table; drops the actual table; creates a new
table without the deleted column; inserts the rows from the temporary table to the new table; then
creates the indexes and the constraints on the new table.
Example
The %COLUMN% variable is the name or code of the column defined in the column list window
of a table.
AltModifyColnNull
Description
Command for modifying the mandatory option (null/not null) in an alter table statement. This
parameter is used in the database modification script when the mandatory option has been modified
on a column.
If AltModifyColnNull is empty, the modify database process drops the foreign key constraints;
creates a temporary table with the same structure and columns as the table before the mandatory
option modification; inserts the rows from the old table to the new temporary table; drops the
actual table; creates a new table with the new Null/Not Null value for the modified column; inserts
the rows from the temporary table to the new table; then creates the indexes and the constraints on
the new table.
Example
The %COLUMN% variable is the name or code of the column defined in the column list window
of a table. The %NOTNULL% variable is Null or Not Null depending on the mandatory option of
the modified column.
AltModifyColnDflt
Description
46
Command for modifying a column default value in an alter table statement. This parameter is used
in the database modification script when the default value of a column has been modified in the
table.
If AltModifyColnDflt is empty, the modify database process drops the foreign key constraints;
creates a temporary table with the same structure and columns as the table before the default value
modification; inserts the rows from the old table to the new temporary table; drops the actual table;
creates a new table with the new default value for the modified column; inserts the rows from the
temporary table to the new table; then creates the indexes and the constraints on the new table.
Example
The %COLUMN% variable is the name or code of the column defined in the column list window
of a table. The %DEFAULT% variable is the new default value of the modified column.
AltModifyColnChk
Description
Command for modifying a column check in an alter table statement. This parameter is used in the
database modification script when the check parameters of a column have been modified in the
table.
If AltModifyColnChk is empty, the modify database process drops the foreign key constraints;
creates a temporary table with the same structure and columns as the table before the check
parameter modification; inserts the rows from the old table to the new temporary table; drops the
actual table; creates a new table with the new check parameters on the column; inserts the rows
from the temporary table to the new table; then creates the indexes and the constraints on the new
table.
Example
The %COLUMN% variable is the name or code of the column defined in the column list window
of a table. The %CONSTDEFINITION% variable is the check constraint built from the new check
parameters.
AltDropColnChk
Description
Command for dropping a column check in an alter table statement. This parameter is used in the
database modification script when the check parameters have been removed on a column.
If AltDropColnChk is empty, the Modify database process drops the foreign key constraints;
creates a temporary table with the same structure and columns as the table before the check
parameter deletion; inserts the rows from the old table to the new temporary table; drops the actual
table; creates a new table without any check parameters on the modified column; inserts the rows
from the temporary table to the new table; then creates the indexes and the constraints on the new
table.
Example
The %COLUMN% variable is the name or code of the column defined in the column list window
of a table.
AltDropPrimKey
Description
Command for dropping a primary key in an alter table statement. This parameter is used in the
database modification script when the primary key has been removed.
If AltDropPrimKey is empty, the modify database process drops the foreign key constraints;
creates a temporary table with the same structure and columns as the table before the primary key
deletion; inserts the rows from the old table to the new temporary table; drops the actual table;
creates a new table without any primary key; inserts the rows from the temporary table to the new
table; then creates the indexes and the constraints on the new table.
47
Example
AltDropFornKey
Description
Command for dropping a foreign key in an alter table statement. This parameter is used in the
database modification script when a foreign key has been removed.
If AltDropFornKey is empty, the modify database process creates a temporary table with the same
structure and columns as the table before the foreign key deletion; inserts the rows from the old
table to the new temporary table; drops the actual table; creates a new table without the foreign
key; inserts the rows from the temporary table to the new table; then creates the indexes and the
constraints on the new table.
Example
The %CONSTNAME% variable is the code of the foreign key defined in the Integrity property
sheet of a reference.
AltDropTablChk
Description
Command for dropping a table check in an alter table statement. This parameter is used in the
database modification script when a table check constraint has been removed.
If AltDropTablChk is empty, the modify database process creates a temporary table with the same
structure and columns as the table before the table check constraint deletion; inserts the rows from
the old table to the new temporary table; drops the actual table; creates a new table without the
table check constraint; inserts the rows from the temporary table to the new table; then creates the
indexes and the constraints on the new table.
Example
AltDropUnique
Description
Command for dropping a unique clause check in an alter table statement. This parameter is used in
the database modification script when a unique constraint (alternate key) has been removed.
If AltDropUnique is empty, the Mmodify database process creates a temporary table with the same
structure and columns as the table before the unique constraint deletion; inserts the rows from the
old table to the new temporary table; drops the actual table; creates a new table without the unique
constraint; inserts the rows from the temporary table to the new table; then creates the indexes and
the constraints on the new table.
Example
The %COLNLIST% variable is the list of the columns including in the unique constraint.
AltEnableAddPrimKey
Description
48
Primary key allowed in an alter table statement. This parameter is a boolean. It indicates if a
primary key can or cannot be added in a table using an alter table statement.
If AltEnableAddPrimKey is equal to NO, the modify database process drops the foreign key
constraints; creates a temporary table with the same structure and columns as the table before the
primary key addition; inserts the rows from the old table to the new temporary table; drops the
actual table; creates a new table with the new primary key column; inserts the rows from the
temporary table to the new table; then creates the indexes and the constraints on the new table.
Example
AltEnableAddPrimKey = YES
AltEnableAddFornKey
Description
Foreign key allowed in an alter table statement. This parameter is a boolean. It indicates if a
foreign key can or cannot be added in a table using an alter table statement.
If AltEnableAddFornKey is equal to NO, the modify database process does not generate anything.
Example
AltEnableAddFornKey = YES
AltEnableAddTablChk
Description
Table check constraint allowed in an alter table statement. This parameter is a boolean. It indicates
if a table check constraint can or cannot be added in a table using an alter table statement.
If AltEnableAddTablChk is equal to NO, the modify database process drops the foreign key
constraints; creates a temporary table with the same structure and columns as the table before the
table check constraint addition; inserts the rows from the old table to the new temporary table;
drops the actual table; creates a new table with the new table check constraint; inserts the rows
from the temporary table to the new table; then creates the indexes and the constraints on the new
table.
Example
AltEnableAddTablChk = YES
AltEnableAddColnChk
Description
Column check constraint allowed in an alter table statement. This parameter is a boolean. It
indicates if a column check constraint, built from the check parameters of the column, can or
cannot be added in a table using an alter table statement.
If AltEnableAddColnChk is equal to NO, the modify database process drops the foreign key
constraints; creates a temporary table with the same structure and columns as the table before the
column check constraint addition; inserts the rows from the old table to the new temporary table;
drops the actual table; creates a new table with the new column check constraint; inserts the rows
from the temporary table to the new table; then creates the indexes and the constraints on the new
table.
Example
AltEnableAddColnChk = NO
AltEnableAddUnique
Description
Unique clause allowed in an alter table statement. This parameter is a boolean. It indicates if a
unique constraint (alternate key) can or cannot be added in a table using an alter table statement.
If AltEnableAddUnique is equal to NO, the modify database process drops the foreign key
constraints; creates a temporary table with the same structure and columns as the table before the
unique constraint addition; inserts the rows from the old table to the new temporary table; drops the
actual table; creates a new table with the new unique constraint; inserts the rows from the
temporary table to the new table; then creates the indexes and the constraints on the new table.
Example
AltEnableAddUnique
= YES
49
model
DatabaseOption
table
index
IndexOption
alternate key
AKeyOption
Physical options are directly accessible in the List of Tablespaces (TablespaceOption) and in the
List of storages (StorageOption).
They are also displayed in the Default Physical Options window (except for DatabaseOption). The
table option window is displayed below:
The %d and %s variables are not currently checked by PowerDesigner. Therefore it is possible to
use %s for a numeric value.
The %d and %s variables must be at the last position and they must not be followed by other
options.
For example, the following syntax is wrong:
on %s with override
The segmentname corresponds to the storage code defined in PowerDesigner. The databasename
corresponds to the model code. These two fields are automatically generated by PowerDesigner.
The devicename must be entered by the user. Thus the devicename becomes an option.
In the SYSTEM11.DEF file, this option is defined as follows:
CreateStorage = execute sp_addsegment %STORAGE%, %DATABASE%,
StorageOption =
<devname> %s
51
A combination box listing the values is displayed between the Option listbox and the Other Options
textbox.
Note: If Default= and List= are used at the same time, they must be separated by a comma.
For example, if ignore_dup_row is the default value for an index, the syntax used in the DEF file to
define this value is the following:
IndexOption =
<duprow> %s: default= ignore_dup_row, list=ignore_dup_row | allow_dup_row
The values defined in Default= and List= cannot be used with the %d or %s variable. For example,
the following syntax is not correct:
with %s: list= default fill factor percent %s | max_row_per_page %s
A combination box listing the storages is displayed between the Option listbox and the Other
Options textbox.
The With physical option includes other options, separated by a comma. To define a composite
option, three keywords (composite=, separator=, and parenthesis=) and two brackets are
necessary.
52
Keyword
composite=
separator=
parenthesis=
Default= and/or List= can also be used with the composite=, separator= and parenthesis=
keywords. Category= can be used with the three keywords of a complex option.
For example, the DB2 index options contain the following composite option:
IndexOption =
using stogroup %s : category=storage, composite=yes, separator=no, parenthesis=no
{
}
When you select the Use checkbox corresponding to the comma or the composite comma, the
block of options between the brackets is copied one time in the Options window as follows:
fragment by expression
{
<frag-expression>
in
remainder in
,
,
<frag-expression>
in
remainder in
,
}
If you select the Use checkbox of the last composite comma, the block is copied one time again,
and so on.
53
Example
This example comes from the DB2.DEF file and applies the previous explanations about the
physical option definition.
IndexOption =
using vcat %s
using stogroup %s : category=storage, composite=yes, separator=no, parenthesis=no
{
priqty %d : default=12
secqty %d
erase %s : default=no, list=yes | no
}
freepage %d : default=0
pctfree %d : default=10
gbpcache %s : default=changed, list=all | changed
CLUSTER : composite=yes, separator=no, parenthesis=yes
{
part %d
values : composite=yes, separator=no, parenthesis=yes
{
<constant> %d
, : composite=no, separator=yes, parenthesis=no
}
using vcat %s
using stogroup %s : category=storage, composite=yes, separator=no, parenthesis=no
{
priqty %d : default=12
secqty %d
erase %s : default=no, list=yes | no
}
freepage %d : default=0
pctfree %d : default=10
gbpcache %s : default=changed, list=all | changed
, : composite=no, separator=yes, parenthesis=no
}
subpages %d : default=4, list=1 | 2 | 4 | 8 | 16
bufferpool %s : list=BP0 | BP1 | BP2
close %s : default=yes, list=yes | no
dsetpass %s
defer %s : default=no, list=yes | no
If the TableOption and IndexOption parameters are empty, the Physical Options checkbox in the
Generate Database window and in the Modify Database window are grayed. In addition there is no
corresponding tab in the Default Physical Options window.
For example, if the DEF file contains the following empty parameter:
TableOption=
then the Physical options checkbox of the Generate Database window and the Modify Database
window is grayed in PowerDesigner.
DatabaseOption
If the DatabaseOption parameter is empty, the Physical Options checkbox on the Database page of
Generate Database window is grayed.
PkeyOption and
AKeyOption
If the PkeyOption and AKeyOption parameters are empty, there is no corresponding tab in the
Default Physical Options window.
For example, if the DEF file contains the following empty parameter:
PkeyOption=
then the Default Physical Options window does not have any Primary Key tab.
54
Tabs are displayed for the corresponding physical option that has a value. For example, if
TablespaceOption has values, the List of Tablespaces menu item is available and the Default
Physical Options window has a tab labeled Tablespace.
model
DatabaseOption
table
index
IndexOption
alternate key
AKeyOption
Physical options are directly accessible in the List of Tablespaces (TablespaceOption) and in the
List of storages (StorageOption).
They are also displayed in the Default Physical Options window (except for DatabaseOption). The
physical options defined in the DefXXXOption parameters are displayed in the Options window,
with the Use option selected by default.
This concerns only the Default Physical Options window, the Options window of the new objects
(table, index, and so on), and the objects without already used physical options. The
DefXXXOption parameters correspond to the values of the physical options applied by default to
the objects.
Example
The user would like to have max_rows_per_page=1, sorted_data and ignore_dup_row on each
index by default.
The parameter corresponding to IndexOption is DefIndexOption. The definition of the default
index options follows the syntax of the DEF file but the %d and %s are replaced by the good
values:
DefIndexOption =
with
{
max_rows_per_page= 1
sorted_data
ignore_dup_row
}
55
These options appear in the Options window when a new index is created in a table or when the
indexes do not have any used physical options. They also appear in the Default Physical options
window as shown below:
Parameters to define the format of profiles used for test data generation
There are three parameters to define the format of the time and date profiles:
ODBCDateFormat
ODBCTimeFormat
ODBCDatetimeFormat
The characters to define time are H for the hours, M for the minutes and S for the seconds. These
characters must be in uppercase.
The characters to define date are d for the days, m for the months and y for the years. These
characters must be in lowercase.
Example
The default values for these parameters are the standard ODBC 2.0 values.
Parameter
Default format
ODBCDateFormat
{d yyyy-mm-dd}
ODBCTimeFormat
{t HH:MM:SS}
ODBCDatetimeFormat
The test data generation process reads the DEF file and applies the format directly without adding
any other character.
SQLTableOption
Description
SQL command for obtaining the table physical options when you reverse engineer a database via
an ODBC driver. This is a select statement on the system tables.
The select statement defined in the standard DEF files contains a maximum of three joins. The
reverse engineering speed depends on the number of joins.
Example
SQLTableOption =
select "on " + s.name + " with max_rows_per_page = " + convert(CHAR, i.maxrowsperpage)
from syssegments s, sysindexes i, sysobjects o
where o.name = '%TABLE%' and i.id= o.id and o.type = 'U' and i.indid<2 and i.segment = s.segment
SQLIndexOption
Description
SQL command for obtaining the index physical options when you reverse engineer a database via
an ODBC driver. This is a select statement on the system tables.
The select statement defined in the standard DEF files contains a maximum of three joins. The
reverse engineering speed depends on the number of joins.
Example
SQLIndexOption =
select "with max_rows_per_page= " + convert(CHAR, i.maxrowsperpage) + " on " + s.name
from syssegments s, sysindexes i, sysobjects o
where o.name = '%TABLE%' and i.name = '%INDEX%' and o.type = 'U' and i.id = o.id and i.indid>=2
and i.segment = s.segment
SQLAkeyOption
Description
SQL command for obtaining the alternate keys (unique constraint defined on a table) when you
reverse engineer a database via an ODBC driver. This is a select statement on the system tables.
Example
Parameter
Group functions
GroupFunc
Number functions
NumberFunc
Character functions
CharFunc
Date functions
DateFunc
Conversion functions
ConvertFunc
Other functions
OtherFunc
Functions are used to return information from the database. They are allowed anywhere an
expression is allowed. There is always only one function per line in the DEF file.
57
The examples used in this document are issued from the built-in functions supported by Oracle,
Sybase SQL Anywhere and Sybase System 11, DB2 MVS and DB2 CS, Informix and Access.
Example
The functions appear in PowerDesigner in the Categories windows. You can use the procedures
below to display the available functions for a particular PowerDesigner functionality:
58
Select a table.
Select a rule.
Select a view.
Select Current Model from the Apply To dropdown listbox to modify the template in the
current model only.
Select Current Model from the Apply To dropdown listbox to modify the item in the current
model only.
GroupFunc
Description
List of group (aggregate) functions. The group functions are used to summarize data over a group
of rows from the database. The groups are formed using the GROUP BY clause of the SELECT
statement.
Group functions are only allowed in the select list and in the HAVING and ORDER BY clauses of
a SELECT statement.They cannot be used in a WHERE clause.
Group functions follow the general form:
function_name ( [all
distinct] expression )
59
Description
avg()
Returns the average of all values in the specified column or expression. You can
apply the AVG keyword only to number columns. Nulls are ignored unless every
value in the specified column is null. If every column value is null, returns a null
for that column
count()
Returns the number of rows in each group where the expression is not the NULL
value. Count can be used with all data types except text and image
list()
Returns a string containing a comma-separated list composed of all the values for
the string expression in each group of rows. Rows where the string expression is
the NULL value are not added to the list
max()
Returns the maximum expression value found in each group of rows. Rows where
expression is the NULL value are ignored*#
min()
Returns the minimum expression value found in each group of rows. Rows where
expression is the NULL value are ignored*#
sum()
Returns the total of the expression for each group of rows. Rows where the
expression is the NULL value are not included*
NumberFunc
Description
List of number (mathematical) functions. Number functions return values commonly needed for
operations on mathematical data. Number function names are not keywords.
The number functions take the general form:
function_name (arguments)
Description
abs()
Returns the absolute value of a numeric expression. Results are of the same type
and have the same precision and scale as the numeric expression
cos()
mod()
Returns the remainder when the dividend is divided by the divisor. Division
involving a negative dividend will give a negative or zero result
pi(*)
sqrt()
CharFunc
Description
List of character (string) functions. The character functions operate on binary data, character
strings, and expressions. Character functions return values commonly needed for operations on
character data. Character function names are not keywords.
The string functions take the general form:
function_name (arguments)
60
Description
lcase()
left()
length()
Returns the number of characters in the string expression. If the string expression
is of binary data type, the LENGTH function behaves as BYTE_LENGTH
ltrim()
substr()
Returns the substring of a string expression starting at the given start position
(origin 1). If the length is specified, the substring is restricted to that length.
Both start and length can be negative.A negative starting position specifies a
number of characters from the end of the string instead of the beginning*
* A positive length specifies that the substring adds length characters to the right of the starting position, while a negative
length specifies that the substring adds length characters to the left of the starting position.
DateFunc
Description
List of date functions. Date functions are used to manipulate date,time,datetime,timestamp values.
Date functions can take arguments and can be reserved keywords.
Standard date functions are described below.
Function
Description
Current_date
The current year, month and day represented in the DATE data type
Current_time
The current hour, minute, second, and fraction of a second represented in the TIME
data type#
Current_timestamp
month()
now(*)
Returns the current date and time. This is the historical syntax for CURRENT
TIMESTAMP
# Although the fraction of a second is stored to 6 decimal places, the current time is limited by the accuracy of the system
clock. Under DOS and Windows, the clock is only accurate to approximately 1/18th of a second, rounded to two decimal
places
ConvertFunc
Description
List of conversion functions. Data type conversion functions change expressions from one data
type to another. They can also specify new display formats for date and time information.
Standard conversion functions are described below.
Function
Description
cast()
string()
Concatenates the strings into one large string. NULL values are treated as empty strings
(). Any numeric or date parameters are automatically converted to strings before
concatenation.
Can also be used to force any single expression to be a string by supplying that expression
as the only parameter
61
OtherFunc
Description
List of other functions. Other functions return special information from the database.
Standard functions of the Other functions category are described below.
Function
Description
isnull()
sqlcode
sqlstate
user
ListOperator
Description
The list of operators appears in the same Categories windows that you also use to display the list of
functions (you must select Category Operators Operator instead of selecting
Category Functions Function).
The list of operators is also available from the Query Editor. You can use the procedure below to
display the available operators from the Query Editor:
Select a view.
The ListOperators parameter lists the comparison operators, the relational operators, and the
logical operators.
Example
62
= all
<> all
> all
< all
>= all
<= all
When you upgrade PowerDesigner, the existing DEF files are removed and replaced by the new
ones. To save modifications that you made to an existing DEF file, you must change the file
name and change the DbmsName parameter (for example : DbmsName = My Database). The
DbmsName is found at the beginning of the DEF file and must be unique..
Description
Integer (I)
Can store 32-bit integer numbers. Depending on the DBMS, short and long
integers can be stored in the same way.
Any precision and length can be entered for this data type in the Standard Data
Types dialog box
Can store 16-bit integer numbers. It can be equal to the Integer data type if the
Short Integer data type is not supported in the target DBMS
Can store 64-bit integer numbers. It can be equal to the Integer data type if the
target DBMS does not support the Long Integer data
Number (N)
Can store numbers with a fixed decimal point. The length is specified in the
Length field and the precision in the Precision field of the Standard Data Types
dialog box. This data type can be equal to the Decimal data type for certain
DBMSs
Byte (BT)
Can store at least 256 values. If the target DBMS does not support this data
type, a translation is made to the Number data type with a length of 3. The
translation can also be made to the Short Integer data type.
A length can be entered for this data type in the Standard Data Types dialog box
Decimal (DC)
Can store numbers with a fixed decimal point. The length is specified in the
Length field and the precision in the Precision field of the Standard Data Types
dialog box. This data type can be equal to the Number data type for certain
DBMSs
Float (F)
Can store 32 bit floating decimal point numbers. If you enter a length for this
data type, it defines the storage of the Float data type in the DBMS
63
Data type
Description
Can store floating decimal point numbers of less than 32 bits. This data type can
be equal to the Float data type if there is no Short Float
Can store 64 bit floating decimal point numbers (double precision for 15 or 16
digits depending on the DBMS). This data type can be equal to the Float data
type if there is no Short Float in the target DBMS
Money (MN)
You can specify the length and the precision for this data type in the Length and
Precision fields of the Standard Data Types dialog box. The default length is 8
and the default precision is 2.
The translated representation of money depends upon the target DBMS. If the
target DBMS does not support the money data type, a translation to the Number
data type is performed for the PDM generation
Character data
types
Serial (NO)
Boolean (BL)
Description
Characters (A)
Can store character strings with a fixed length that you can specify in the
Length field of the Standard Data Types dialog box
Can store character strings with a variable length that does not surpass the
specified value in the Length field of the Standard Data Types dialog box.
The variable length allows you to ignore certain characters, such as spaces at
the end of a string.
This data type can be equal to the Characters data type with a length of 255
bytes for certain DBMSs
64
Can store character strings longer than 255 bytes with a fixed length that
you can specify in the Length field. This data type is target-specific.If the
target DBMS does not support this data type, a translation to the Variable
Characters data type is performed for the PDM generation
Can store character strings longer than 255 bytes with a variable length in
the length field. The variable length allows you to ignore certain characters
such as spaces at the end of a string. This data type is target-specific. If the
target DBMS does not support this data type, a translation to the Long
Characters data type is performed for the PDM generation.
Text (TXT)
Can store character strings of variable length that are longer than 255
characters. It is target-specific. If the target DBMS does not support this
data type, a translation to the Long Characters data type is performed for the
PDM generation
Multibyte (MBT)
Can store multibyte character strings with a fixed length specified in the
Length field of the Standard Data Types dialog box. This data type can be
equal to the National character if it is supported by the target DBMS. If the
database does not support this data type, a translation to the Characters data
type is performed for the PDM generation
Can store multibyte character strings with a variable length that does not
surpass the specified value in the Length field of the Standard Data Types
dialog box. This data type can be equal to the National variable character if
the target DBMS supports it. If the database does not support this data type,
a translation to the Variable Characters data type is performed for the PDM
generation
No length or precision can be entered for these data types. Time data types are described in the
table below:
Data type
Description
Date (D)
Can store the date in the day, month, and year format. For PDM generation, the Date
data type is translated into the date format of the target DBMS. If the target DBMS
does not support Date, it will be translated into a character string with a length of 8
Time (T)
Can store time with the hour, minute, and seconds format. The representation format
equals the format of the target DBMS. If the target DBMS does not support this data
type, a translation to the Date data type is performed for the PDM generation
Formats the date and time. It is DBMS-specific. If the target DBMS does not support
this data type, a translation to the Date data type is performed for the PDM
generation
Timestamp (TS)
Represents the system date and time. It is DBMS-specific. If the target DBMS does
not support this data type, a translation to the Date data type is performed for the
PDM generation
Data types of the Other data type category are described in the table below:
Data type
Description
Binary (BIN)
Can store binary strings with a length specified in the Length field of the Standard
Data Types dialog box.
The binary data type results in information that cannot be converted to another
data type. If the target DBMS does not support this data type, a translation to the
Text data type is performed for the PDM genreation
Can store binary strings of fixed length. It is DBMS-specific.If the target DBMS
does not support this data type, a translation to the Binary data type is performed
for the PDM genreation
Image (PIC)
Can store images. If the target DBMS does not support this data type, a translation
to the Long Binary data type is performed for the PDM generation
Bitmap (BMP)
Can store images in the bitmap format. If the target DBMS does not support this
data type, a translation to the Long Binary data type is performed for the PDM
generation
OLE (OLE)
Can store data concerning OLE links. If the target DBMS does not support this
data type, a translation to the Long Binary data type is performed for the PDM
genreation
Other (*)
Designates all other user defined data types. The default data type is a character
with a length of 10.
A new data type can be defined in the List of Data Types section of the DEF file
for the target DBMS. At the end of this section, after the definition of all the data
types, you can add the necessary lines to define any new data types*
Undefined <UNDEF>
* For example, if the target database is Oracle7, to define a DESCRIPTION type , you should add the following line in the
Oracle7.DEF: DESCRIPTION = VARCHAR(20). Then you could use this data type in the CDM by selecting the Other
data type and by entering DESCRIPTION in the Code field of the Standard Data Types dialog box
The DEF file lists the correspondence between PowerDesigner conceptual data types and the target
database data types. This list is used for PDM generation from a CDM.
In the DEF file, the data types before the = sign are the conceptual data types. The data types after
the = sign are the target database data types.
65
Example
The DEF file lists the correspondence between the target databases data types and the
PowerDesigner conceptual data types. It is used for Reverse Engineering, for the generation of a
CDM from a PDM, and for listing physical data types.
The data types before the = sign are the target database data types. The data types after the = sign
are the PowerDesigner conceptual data types.
Example
66
=
=
=
=
=
=
=
<UNDEF>
A%n
MB%n
VA%n
VMB%n
VA30
BT
smallint
int
integer
numeric
numeric(%n)
numeric(%s,%p)
dec
dec(%n)
dec(%s,%p)
decimal
decimal(%n)
decimal(%s,%p)
real
float
float(%n)
double precision
smallmoney
money
smalldatetime
datetime
timestamp
bit
binary(%n)
varbinary(%n)
text
image
*
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
SI
I
I
N
N%n
N%s,%p
DC
DC%n
DC%s,%p
DC
DC%n
DC%s,%p
SF
F
F%n
LF
MN
MN
DT
DT
TS
BL
BIN%n
LBIN%n
TXT
PIC
A10
This DEF file lists the correspondence between the target database data types and ODBC data
types. The list is used for generation via an ODBC driver.
The data types before the = sign are the target database data types. The data types after the = sign
are the ODBC data types.
The ODBC data types are the data types listed in Intersolv drivers and in the ODBC driver of the
target database constructor. The core ODBC drivers use their own data types and do not recognize
all the target database types.
Example
The DEF file lists the correspondence between ODBC data types and the target database data
types. The list is used for Reverse Engineering using an ODBC driver.
The data types before the = sign are the ODBC drivers data types. The data types after the = sign
are the target database data types.
Example
67
smalldatetime(%n)
datetime(%n)
timestamp(%n)
bit(%n)
text(%n)
image(%n)
=
=
=
=
=
=
smalldatetime
datetime
timestamp
bit
text
image
This table lists the correspondence between the target database data types and the trigger data
types. These data types are described in the target database documentation. In general this list
restricts the data types used by the triggers.
Example
Storage size of a target database data type for Compute Database Size
Description
Usually the data types have a default length. When this is not the case, the data type is added to a
DEF file list with a size to be used for computational purposes.
Example
=
=
=
=
8
4
8
8
68