Use power designer to design databases and generate scripts

Source: Internet
Author: User
Tags to domain powerdesigner

If you only need to create a physical model (typically a database table), you can
After the project is created, new -- physical data model is created. Then you can start to draw the table.

Drawing Table:

To draw a table, double-click the table icon to go to the properties page. Here, the name is in powerdesigner.
The name shown only for your convenience. It has nothing to do with the database. The code is in the database encoding,
There is a comment in general, which is in the database comment. In the columns tab,
You can edit columns in a table. Note that the name of each row is also the name displayed in powerdesigner,
This is just for your convenience, and it has nothing to do with the database. Code is the field encoding in the database.
Then how can the comment disappear? Double-click the leftmost line number. The detailed attribute editing page for this attribute is displayed.
Here we can see comment (there should be some other settings here, not very important, let's take a look ).
(There is also a way to view comment directly on the column page. Therefore, we need to customize the content displayed by column,
There is a row of icons on this tab, such as inserting a row, and there is a small funnel icon customize
Coulumns and filter. Click to check the attributes we want to display and find the comment check)

Draw Association:

In tools -- display references, you can set format -- references.
The line style (curve, color, etc.) associated with the foreign key ). You also know that you can set
Tables, views, and Other display styles in powerdesigner.

In the foreign key association formula, select references in the tool. For example, the B _id field in Table A is from Table B.
Foreign key, draw an arrow from Table A to table B. After painting, you can double-click this line to bring up the property page,
Name, code is also displayed in powerdesigner for your convenience. in the database, the associated name is
The integration tab can be viewed and editable. You can also go to the priview tab to check the actual
SQL statement.
Note: what you see in priview is the actual SQL statement to be generated.

Database reports;

After drawing the database table box view, we save it. The file *. PDM format is saved. This is powerdesigner.
The default file format. If we want to make it easier for others to view the database structure we designed, it is best to export reports instead
This is saved as a PDM file because someone else has to install the powerdesigner software.

Click report -- generate report to bring up the export report page.
Select the default full physical report (all physical reports ),
Generate HTML (select the final generated HTML format and use a browser
Open the file. Select generate RTF and generate the final file in the RTF format. Use the word
Can be opened), and the name and export path of the report should be written below. Needless to say,
Note that in the Laguage drop-down list, select Simplified Chinese (
(Simplified Chinese), otherwise the generated file contains Chinese characters and garbled characters.

 

 

 

Now we can generate a database for the painted design,
First, we need to set the quotation marks for the script generation, because
When Pd generates an SQL statement for creating an Oracle database table, double quotation marks are added to the table name and field name by default.
Solution:
Set database → editcurrentdbms → General → script → SQL → format → casesensitivityusingquote to No.

Select generate database from the dastabase menu, select the Directory and file name, and click OK.
Find the generated SQL file in the directory and open PLSQL,
It cannot be run directly, because some SQL statements report errors, drop statements, and view statements.
The drop error is reported because the table or view has not been created. The view is not defined in powerdesigner,
So an error is reported. comment out the comments.

 

 

 

 

& --- Use Power Designer -----&&&&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

Powerdesigner removes double quotation marks from SQL scripts
◇ Problem description:
When Pd generates an Oracle database table creation SQL statement, double quotation marks are added to the table name and field name by default. How can we remove the double quotation marks in the SQL script?
◇ Solution:
Set database → editcurrentdbms → General → script → SQL → format → casesensitivityusingquote to No.

 

Set the default font of entity in powerdesigner

◇ Problem description:
When you create an entity object, if the default PD font is not suitable for your personal habits, it is very troublesome to modify the font of the object every time you create an object, is there a way to change once and for all?
◇ Solution:
Tools → displaypreferences... → format → entity → modity... → font → modify and Save settings → setasdefault

Cancel name and code Association
When changing the name, the code value will change, which is inconvenient. Modification Method: Modify the Options menu in powerdesign. In [Tool] --> [General options]-> [Dialog]-> [operating modes]-> [name to code signing ing], by default, the name and code are synchronized. just remove the check box above.

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&

Modify the table creation script generation rules.
If each table has the same field, you can modify it as follows:
Database-> edit current DBMS expand script-> Object-> table-> Create to see the value in the lower right corner. You can directly modify the value as follows:

/* Tablename: % tname % */
Create Table [% qualifier %] % table % (
% Tabldefn %
TS char (19) null default convert (char (19), getdate (), 20 ),
Dr smallint null default 0
)
[% Options %]

The Ts and Dr columns are automatically inserted into each table when an SQL script is generated, the % tname % variable adds a name value comment to the SQL statement of each table.

 

Domain is not used when powerdesigner generates SQL statements.
◇ Problem description:
If domain is used in PD, the SQL script of the database that generates sqlserver uses the custom data type corresponding to domain instead of the SQL server data type, how can we allow PD to use sqlserver's own database type when generating SQL statements, instead of the custom data type corresponding to domain?
◇ Solution:
Set database → editcurrentdbms → General → script → objects → domain → enable to No.

 

Set entity in powerdesigner to automatically resize
◇ Problem description:
When a field or other modification is added to entity, the display size of entiry is not automatically adjusted. How can this problem be solved?
◇ Solution:
Right-click entity → click format... menu → select size tab → select autoadjusttotext

Set table attribute preview in powerdesigner
◇ Problem description:
How can I modify the SQL statements generated by clicking table attribute preview?
◇ Solution:
Right-click the selected table, click Properties... menu item, select physicaloptions, and click applyto in the lower left corner.
In the top toolbar of the preview options, click showgenerationoptions to set the syntax format of other production SQL statements.

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.