将powerdesigner 中PhysicalDiagram 模型 comment字段转name

在tools --excute commonds--run/edit script...里面执行下面的代码

Option Explicit
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
   ProcessPkg mdl
End If

' This routine copy name into code for each table, each column and each view
' of the current folder
Private sub ProcessFolder(pkg)
   Dim Tab 'running  table
   Dim col
   for each Tab in pkg.tables
      ' 表注释
       if(len(tab.comment)<>0) then
       tab.name = tab.comment
       end if
      ' 表名大写
      'tab.code = Ucase(tab.code)
    if not tab.isShortcut Then         
     For each col in tab.columns
            ' 列注释
        if len(col.comment) <> 0 then   
            col.name = col. comment
          End if 
            ' 列名大写
            col.code = Ucase(col.code)
            On Error Resume Next  
     Next
    End If
    On Error Resume Next  
   Next
End sub
Private Sub ProcessPkg(mdl)
  ProcessFolder(mdl)
  Dim subpkg
   For each subpkg in mdl.packages
     ProcessPkg(subpkg)
   Next
End Sub

你可能感兴趣的:(将powerdesigner 中PhysicalDiagram 模型 comment字段转name)