SQL Create Table |
|
The Generate SQL Create Table Commands utility simplifies the process of converting the data dictionary to a SQL-based database such as ORACLE or Microsoft SQL. The utility outputs CREATE TABLE directives for defining database tables that are consistent with the PxPlus data dictionary. By default, this output includes all the fields within a table definition, including fields in non-normalized tables.
In the case of non-normalized files, duplicate element names are output once, and the first occurrence of the element name defines the element's format. Table Index definitions will also be created using either the Key name as supplied in the Data Dictionary definition or a generated name based on the Table Name followed by an underscore and key number. The Generate button outputs the CREATE statements to the utility window for viewing.
Invoke the Generate SQL Create Table Commands utility by selecting Utilities > Generate external > SQL Create Table from the Data Dictionary Maintenance menu bar.
This utility consists of the following:
Table Name |
Click the Query Table View button (magnifying glass) for a tree view of table names by Group. For information on creating a filter to locate a specific table name, see Filtering the Table Names Lookup. |
Use Double Quotes |
Check box to enclose the table and element names in double quotes. |
Copy to Clipboard |
(Available after CREATE statements are generated) Button used to copy the generated CREATE statements to the Clipboard. |
Generate |
Button used to generate the CREATE statements. The output is displayed in the utility window for viewing purposes and can be output to a file or the Clipboard, if desired. |
Export |
(Available after CREATE statements are generated) Button used to export the generated CREATE statements to a file. |
Close |
Exits the Generate SQL Create Table Commands utility. |
The SQL Create Table utility can also be called from a PxPlus program.
CALL "*DICT/GENSQL",contents$,errmsg$,tablename$,ddf_path$,quo_char$
Where:
contents$ |
SQL CREATE commands are returned in this variable. |
errmsg$ |
Warning and error messages are returned in this variable. |
tablename$ |
Logical table name. |
ddf_path$ |
Pathname of the providex.ddf file (defaults to simple pathname). |
quo_char$ |
Character to enclose tables, columns, indexes names (defaults to null). |