数据库
首页 > 数据库> > PowerDesigner sql生成pdm,pdm的name和注释互换

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

作者:互联网

首先数据库生成sql文件,然后打开pdm文件:
打开文件(file)——选中反向工程(reverse Engineer)——数据库(database)
如下图:
自己更改模型的名称
然后:选中脚本文件,点击添加已经导出的sql,然后点击确定就可以生成对应的模型。
选中使用脚本

操作步骤:
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即可

标签:name,mdl,PowerDesigner,current,pdm,each,col
来源: https://www.cnblogs.com/360minitao/p/12982479.html