Powerdesigner copies the name column value in the table to the comment column (Retain the original comment ),

Source: Internet
Author: User
Tags powerdesigner

Powerdesigner copies the name column value in the table to the comment column (Retain the original comment ),

  1. /**
  2. * Copy the name column value in the table to the comment column in PowerDesigner.
  3. * @ See Tables --------------------------------------------------------------------------------------------------------------------
  4. * @ See pd when pdm generates SQL by default, the field is not annotated .. if you want to annotate, there are two methods
  5. * @ See 1. It is also recommended.
  6. * @ See pdm double-click to open a Table, go to the Columns tab, press the shortcut key Ctrl + U, find the Comment, and select
  7. * @ See and set this operation once. Comment will automatically appear in the new Table.
  8. * @ See: after the table field is set, add a comment when adding the table field so that the field in the generated SQL statement will be commented out.
  9. * @ See 2. Run the vbs script
  10. * @ See compared to the first method, the disadvantage of this method is that the script must be executed once before each SQL statement is generated.
  11. * @ See: the execution method is Tools --> Execute Commands --> Edit/Run Scripts, or the shortcut key Ctrl + Shift + X
  12. * @ See: copy the following script and execute it again. You can also save it as name2comment. vbs. (If you execute it again next time, you can press Ctrl + O and select name2comment. vbs)
  13. * @ See Tables --------------------------------------------------------------------------------------------------------------------
  14. */

 

'If the comment is empty, enter name. If the comment is not empty, the value remains unchanged. this avoids the loss of existing annotations. option Explicit ValidationMode = True InteractiveMode = im_Batch Dim mdl 'the current model' get the current active model Set mdl = ActiveModel If (mdl Is Nothing) then MsgBox "There is no current Model" ElseIf Not mdl. isKindOf (PdPDM. cls_Model) Then MsgBox "The current model is not an Physical Data model. "Else ProcessFolder mdl End If 'this routine copy name into comment for each table, each column and each view of the current folder Private sub ProcessFolder (folder) dim Tab 'running table for each Tab in folder. tables if not tab. isShortcut then if trim (tab. comment) = "" then' if there is a comment on the table, it is not changed; if there is no comment on the table, the name is added to the comment. tab. comment = tab. name end if Dim col 'running column for each col in tab. columns if trim (col. comment) = "" then' if col's comment is empty, enter name. If comment already exists, no comments are added. this prevents loss of existing annotations. col. comment = col. name end if next Dim view 'running view for each view in folder. views if not view. isShortcut and trim (view. comment) = "" then view. comment = view. name end if next 'go into the sub-packages Dim F' running folder For Each f In folder. packages if not f. isShortcut then ProcessFolder f end if Next end sub

 

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.