PowerDesigner sql生成pdm,pdm的name和注释互换

  • 将sql文件转化成pdm模板

首先数据库生成sql文件,然后打开pdm文件:
打开文件(file)——选中反向工程(reverse Engineer)——数据库(database)
如下图:
PowerDesigner sql生成pdm,pdm的name和注释互换
然后:选中脚本文件,点击添加已经导出的sql,然后点击确定就可以生成对应的模型。
PowerDesigner sql生成pdm,pdm的name和注释互换

  • 将pdm的name和注释互换位置
    显示效果如图:
    PowerDesigner sql生成pdm,pdm的name和注释互换

操作步骤:
Open PDM – Tools – Execute Commands – Run Script
复制下面的代码:
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 code 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 len(tab.comment) <> 0 then
tab.name = tab.comment
end if
On Error Resume Next
Dim col 'running column
for each col in tab.columns
if len(col.comment) <>0 then
col.name =col.comment
end if
On Error Resume Next
next
end if
next
end sub

点击run即可

上一篇:PDM


下一篇:超详细 PowerDesigner 入门教学(项目数据库设计标准)