Powerdesigner advanced vbs applications

Source: Internet
Author: User
Tags powerdesigner
1. Write related vbs scripts
You can customize some commands and operations in powerdesign. For details, refer to the script example in the [powerdesigner installation directory] \ VB scripts directory.
How can we use these scripts?
You can perform operations in tools-execute commands. For more information, see help.
The help is located
Powerdesigner general features Guide
-> Working with scripts
-> Accessing objects using VBScript
-> VBScript uses in powerdesigner
Ii. advanced use of powerdesign mainly involves DBMS Configuration

1. 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.

2. Modify the field generation rules. To add a comment for each field, expand the value of script-> Object-> column-> Add in the same window:

% 20: column % [% compute %? As (% compute %): % 20: datatype % [% identity %? % Identity %: [% null %] [% notnull %] [Default % default %]
[[Constraint % constname %] Check (% constraint %)]/* % colnname % */

% Colnname % indicates the column name value (which can be Chinese)

3. Modify the foreign key naming rules. Choose database> edit current DBMS.
Select scripts-> objects-> reference-> constname
The value on the right is:

FK _ %. u8: child % _ %. U9: refr % _ %. u8: parent %

It can be seen that the naming method is: 'fk _ '+ 8-seat table name + 9-digit reference name + 8-digit parent table name. You can customize the following mode:

FK _ %. u7: child % _ relations _ %. u7: parent %,

You can change the FK name to fk_table_2_relations_table_1.
After mastering this method, you can modify it according to your own ideas.

The header comment in the SQL file of the database creation script is annoying. You can select the options card in the Databse-> Generate database (CTRL + G) window and remove the usage title hook option.

4. Add a foreign key
Model-> references: Create a foreign key and double-click it to enter the foreign key attribute. In the "joins" card, select the foreign key field of the sub-table.

5. Remove the double quotation marks of the generated SQL Script: Oracle 8i2: script \ SQL \ format \ casesensitivityusingquote to No. The default value is yes, so there will be double quotation marks.

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.