Automatically generate SQL Server field notes in PowerDesigner

Source: Internet
Author: User
Tags powerdesigner

Automatically generate SQL Server field notes in PowerDesigner

PowerDesigner is a common design tool for database designers, but its native default generated code does not generate a field note description for the SQL Server database. It is cumbersome to manually modify the database after it has been generated.

First, we introduce a way to automatically generate a Memo field for SQL Server directly from PowerDesigner.

1. After establishing the physical model in PowerDesigner

2. In PowerDesigner, select the tool-->execute Commends-->edit/run Script and open the following dialog box:

3. Enter the following code in the dialog box:

Option Explicitvalidationmode=Trueinteractivemode=im_batch Dim MDL'The current model 'get the current active modelSet MDL=Activemodelif (MDL is nothing) then MsgBox"There is no current Model"ElseIf not MDL. IsKindOf (Pdpdm.cls_model) then MsgBox"The current model isn't an physical Data model."Else processfolder mdlend If'This routine copy name to comment for each table, each column and each view'Of the current folderPrivate Sub ProcessFolder (folder) Dim Tab'Running Table       forEach TabinchFolder.tablesifNot Tab.isshortcut then tab.comment=tab.name Dim Col'Running Column                   forEach colinchtab.columns col.comment=col.name Next EndifNext Dim View'Running View       forEach viewinchfolder. viewsifNot View.isshortcut then view.comment=View.name EndifNext'go into the sub-packagesDim F'Running FolderFor each f in folder. PackagesifNot F.isshortcut then ProcessFolder F endifNextEnd Sub

4. Click "Run" to execute the code. By previewing the SQL code of the physical model, you can see the database field comment code generated by PowerDesigner.

Automatically generate SQL Server field notes in PowerDesigner

Related Article

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.