PowerDesigner 12 Generate comments by name

Source: Internet
Author: User
Tags microsoft sql server sybase powerdesigner

Preface
Previously used a powerdesigner (after the short of PD), was still used in the 11 version of PD, no in-depth study, a simple trial. Recent projects to use, colleagues have to design the database, but the resulting database table structure does not have annotation information. After a few hours of research finally try to come out, do not know the search method is not right or indeed notGenerate database annotation information based on the name of PDof articles.

Environment
Sybase.powerdesigner 12 Chinese version
Microsoft SQL Server SP3

body
Here, the whole process of producing SQL with PD and producing database table structure is fully demonstrated in the form of a map code.
First step: Create a new custom DBMS:

This just modifies some of the parameters and selects the Copy from Micorsoft SQL SERVER 2000. And then save it as shown:

The following interactive window will then pop up:

Step two: Modify the key feature tree, in the script/objects/table/tablecomment and script/objects/column/columncomment position of the direct modification as follows:
Table-Level comments
EXECUTE sp_addextendedproperty n ' ms_description ', n '%comment% ', n ' user ', n '%owner% ', n ' table ', n '%ta Ble% ', NULL, NULL column-level comment
EXECUTE sp_addextendedproperty n ' ms_description ', n '%name% ', n ' user ', n '%owner% ', n ' table ', n '%table % ', n ' column ', n '%column% ' as shown:

Are you sure.
Step three: The new physical Data Model (PDM), the following is not in detail to accept the map only:



Note: It is best to select the table when it is builtownerWithout creating a new one of your own.
Step Fourth: Configure parameters to generate SQL statements. Toolbar (Tools)-> build Databases (Generate database)

Check the box above, otherwise the annotation will not come out when your comment is empty, or the name (name) can appear as a comment if your note is not empty.

Remove the tick above the user, or the following error may occur when generating SQL statement execution:
Server: Message 15181, Level 16, State 1, Process sp_revokedbaccess, line 43
The database owner cannot be dropped.
Server: Message 15007, Level 16, State 1, Process sp_grantdbaccess, line 98
Login ' dbo ' does not exist.

The final point is to determine the build, and the resulting SQL code for PD is as follows: * ============================================================== * *
/* DBMS name:sql SERVER (EXT) */
/* Created on:2008-2-28 2:49:38 * *
/* ============================================================== */


if exists (select 1
From sysobjects
WHERE id = object_id (' dbo. Employee ')
and type = ' U ')
DROP TABLE dbo. Employee
Go

/* ============================================================== */
* Table:employee * *
/* ============================================================== */
CREATE TABLE dbo. Employee (
ID int NOT NULL,
Username varchar () NULL,
Password varchar () NULL,
Constraint Pk_employee primary KEY (ID)
)
Go

EXECUTE sp_addextendedproperty n ' ms_description ', n ' employee ', n ' user ', n ' dbo ', n ' table ', n ' employee ', NULL, NULL
Go

EXECUTE sp_addextendedproperty
N ' ms_description ', n ' primary key ID ', n ' user ', n ' dbo ', n ' table ', n ' Employee ', n ' column ', n ' id '
Go

EXECUTE sp_addextendedproperty
N ' ms_description ', n ' username ', n ' user ', n ' dbo ', n ' table ', n ' Employee ', n ' column ', n ' Username '
Go

EXECUTE sp_addextendedproperty
N ' ms_description ', n ' password ', n ' user ', n ' dbo ', n ' table ', n ' Employee ', n ' column ', n ' Password '
Go

If you generate a SQL statement that does not follow the following few execution sp_addextendedproperty statements, then this time you will not be able to generate annotated SQL statements, please carefully check the steps and details.
     Step Fifth: Executes the SQL statement generated by PD to generate the table structure.
         executes the resulting SQL statement in Query Analyzer after the table structure is shown in figure:


Complete. You can also comment after the same method modifies the signature in Sybase as Anywhere 7. As for the other there is no one by one test, we are interested can try more, and then study the name + Note to generate database comments, but suffer from the lack of information, do not know such as [%r%?[ N]] and so on syntax, welcome to teach more.

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.