PowerDesigner中把 Comment(描述/注释列)的内容,复制覆盖到 Name(名称列)里

  1. 在 PowerDesigner 中,按 Ctrl + Shift + X 打开脚本运行窗口。
  2. 清空里面原有的内容,粘贴下面的代码:
 
' 把 Comment(描述)的内容 同步到 Name(名称)
Dim mdl ' 当前模型
Set mdl = ActiveModel

If mdl Is Nothing Then
   MsgBox "没有打开模型"
Else
   ' 遍历所有表
   Dim tab
   For Each tab In mdl.Tables
      If Not tab.IsShortCut Then
         ' 遍历表中的所有列
         Dim col
         For Each col In tab.Columns
            ' 只有当 Comment 不为空时,才进行覆盖
            If col.Comment <> "" Then
               col.Name = col.Comment
            End If
         Next
      End If
   Next
   
   MsgBox "处理完成!已将描述更新到名称列。"
End If
 
  1. 点击 Run (运行) 按钮。
  2. 看到提示“处理完成”即可。
把 Comment(描述/注释列)的内容,复制覆盖到 Name(名称列)里
posted @ 2026-07-17 17:56  不知名路人!  阅读(16)  评论(0)    收藏  举报