Powerdesigner 中设计好数据库表,其中 Name 为说明,Code 为字段名称,通过在“工具”-
“运行命令”-“脚本”
Opon Explicit
ValidaonMode = True
InteracveMode = im_Batch
Dim mdl ' the current model
' get the current acve model
Set mdl = AcveModel
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 roune 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
'把表明作为表注释,其实不用这么做
tab.comment = tab.name
Dim col ' running column
for each col in tab.columns
'把列 name 和 comment 合并为 comment
col.comment= col.name
next
end if
next
Dim view 'running view
for each view in folder.Views
if not view.isShortcut then
view.comment = view.name
end if
next
' go into the sub-packages