PowerDesigner 表名的中文及字段的name和comment的替换问题
PowerDesigner中name和comment互換
1 PowerDesigner中批量根据对象的name生成comment的脚本
执行方法: Tools(工具) -- Execute Commands -- Run Script
快捷键: Ctrl + Shift + X
Vb 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
tab.comment = tab.name
Dim col 'running column
for each col in tab.columns
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
Dim f 'running folder
For Each f In folder.Packages
if not f.IsShortcut then
ProcessFolder f
end if
Next
end sub
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
tab.comment = tab.name
Dim col 'running column
for each col in tab.columns
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
Dim f 'running folder
For Each f In folder.Packages
if not f.IsShortcut then
ProcessFolder f
end if
Next
end sub
2 PowerDesigner中逆向工程将数据库中comment脚本赋值到PDM的name
执行方法: Tools(工具) -- Execute Commands -- Run Script
快捷键: Ctrl + Shift + X
Vb 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
分享到:
相关推荐
通常数据表字段使用英文,备注comment完成字段的说明。使用该脚本能够在PowerDesigner批量生成SQL脚本时将name生成数据库中字段的comment
将powerdesigner中物理模型的英文字段名称转换为显示注释
NULL 博文链接:https://yanfei133.iteye.com/blog/1483094
powerdesigner逆向工程导入mysql脚本生成PDM带全注释
PowerDesigner里执行脚本命令,把name列的内容批量复制到comment列。
1 安装ODBC驱动,2 在控制面板添加添加ODBC,3 PowerDesigner连接MYSQL,4 MySQL表结构导入到PowerDesigner,5 显示Comment列,6 PowerDesigner表结构连同中文注释导入到MySQL
PowerDesigner 常用设置大全。...设置6:如何把CODE的NAME中文也生成在脚本中,也就是列名后就是NAME的说明文字? 设置7:怎么在窗口中显示的是对象的Code而不是Name 设置8:name-comment- stereotype的相互自动copy
每次我用PowerDesigner设计数据库时,都只是注释了一些复杂的字段,一些简单的字段根本就不用注释,见到code就知道其中的意思,奈何本人英文水平有限,加上一些英文单词太长进行了简写,我就想要把字段名称name这列...
安装完成后需要先设置一下,解决生成的表中没有字段注释和表注释的问题: 1:点击工具栏中的数据库,选择第二个选项: 2:如图,将值替换为: {OWNER, TABLE, TNAME} select t.table_schema, t.table_name, t.table_...
PowerDesigner 逆向工程脚本,comment2name.vbs 将字段注释转成字段名、表注释转成表名称, name2comment.vbs——名称转注释,已有注释不覆盖。在PowerDesigner 菜单里Tools——Excute Commands——Edit/Run Scripts....
在PD中的"Table Properties"-"General"中的Name填写表的中文名称,在Code中填写表的英文名称。 2.英文名称规范:以名称复数命名",, S002,表注释,"1.在PD中的"Table Properties"-"General"中的Comment中填写表的注释...