The method that replaces the comment column with the Name column as a field description in the generated database script in PowerDesigner

Source: Internet
Author: User
Tags powerdesigner

1 PowerDesigner in the generated database script, replace the comment column with the Name column as a field description as follows,

Open Tools-Execute Commands-run script and run the following script:

Option Explicitvalidationmode=Trueinteractivemode=Im_batchdim MDL'The current model'get the current active modelSet MDL =Activemodelif (MDL is nothing) Thenmsgbox"There is no current Model"ElseIf not MDL. IsKindOf (Pdpdm.cls_model) Thenmsgbox"The current model isn't an physical Data model."Elseprocessfolder mdlend If'This routine copy name to code for each table, each column and each view'Of the current folderPrivate Sub ProcessFolder (folder) Dim Tab'Running Table forEach TabinchFolder.tablesifNot tab.isshortcut thentab.comment=Tab.namedim Col'Running Column forEach colinchtab.columnscol.comment=Col.namenextendifNextdim View'Running View forEach viewinchfolder. viewsifNot view.isshortcut thenview.comment=View.nameendifNext'go into the sub-packagesDim F'Running FolderFor each f in folder. PackagesifNot f.isshortcut Thenprocessfolder fendifNextEnd Sub



2 PowerDesigner Database Reverse engineering assigns the Comment column script to the Name column


Open the Tools-Execute Commands-run script and run the following scripts:

Option Explicitvalidationmode=Trueinteractivemode=Im_batchdim MDL'The current model'get the current active modelSet MDL =Activemodelif (MDL is nothing) Thenmsgbox"There is no current Model"ElseIf not MDL. IsKindOf (Pdpdm.cls_model) Thenmsgbox"The current model isn't an physical Data model."Elseprocessfolder mdlend If'This routine copy name to code for each table, each column and each view'Of the current folderPrivate Sub ProcessFolder (folder) Dim Tab'Running Table forEach TabinchFolder.tablesifNot Tab.isshortcut ThenifLen (tab.comment) <>0Thentab.name=Tab.commentendifOn Error Resume Nextdim Col'Running Column forEach colinchTab.columnsifLen (col.comment) <>0Thencol.name=Col.commentendifOn Error Resume nextnextendifNextEnd Sub

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.