需求:原有数据库是sqlserver,需要转成postgresql数据库,对应的er图也要修改。遇到的问题:反向工程建好的table中的name都变成了code,丢失了原来的中文字段名称
步骤:
1.打开原有er图的pdm文件,选择database -》generate database,在弹出的窗口中,directory选择你导出的路径。selection选择默认即可
2.新建一个pdm(physical data model),file->reverse enginerr->database,选择刚才导出的sql语句。当然,sql语句要根据不同的数据库修改成对应的建表语句。
3.导入。
4.name变成了code,原来视图中的中文注释全部不显示。
5.PowerDesigner->Tools->Execute Commands->Edit/Run Scripts
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
Private sub ProcessFolder(folder)
On Error Resume Next
Dim Tab 'running table
for each Tab in folder.tables
if not tab.isShortcut then
tab.name = tab.comment
Dim col ' running column
for each col in tab.columns
if col.comment="" then
else
col.name= col.comment
end if
next
end if
next
Dim view 'running view
for each view in folder.Views
if not view.isShortcut then
view.name = view.comment
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
当然,他的前提是你的common注释中有你的字段的中文名,否则的话,请参考
http://miaoyue.iteye.com/blog/1223003
感谢猫月
分享到:
相关推荐
PowerDesigner逆向工程导入MYSQL数据库总结 PowerDesigner逆向工程导入MYSQL数据库总结
解决PowerDesigner中Name与Code同步的问题
解决PowerDesigner中Name与Code同步的问题
Powerdesigner字段备注导入到数据库
1 安装ODBC驱动,2 在控制面板添加添加ODBC,3 PowerDesigner连接MYSQL,4 MySQL表结构导入到PowerDesigner,5 显示Comment列,6 PowerDesigner表结构连同中文注释导入到MySQL
PowerDesigner->Tools->Execute Commands->Edit/Run Scripts 将comment覆盖name。 将name自动填充到注释(comment)。
NULL 博文链接:https://yanfei133.iteye.com/blog/1483094
PowerDesigner 中name和comment 互换脚本,可以使用。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
powerdesigner逆向工程导入mysql脚本生成PDM带全注释
powerdesigner视图不支持name,code,comment(列注释)同时显示,本文档完美解决了这个问题。快乐源于分享,需要的拿走
本文描述了powerdesigner从数据库导入数据的完整过程,图文并茂,细节很清楚,很容易看懂,希望可以帮到各位。
PowerDesigner数据库表的导入导出和连接数据库
powerdesigner中name和code相关联对程序设计造成不便,可以按照文档进行设置;对于powerdesigner导出的sql代码有引号的解决方案。
powerDesigner 把name项添加到comment 使用方法使用方法 PowerDesigner->Tools->Execute Commands->Edit/Run Scripts 可以保存该脚本为:name2comment.vbs
NULL 博文链接:https://fly5650104.iteye.com/blog/810556
PowerDesigner中使name列的值等于comment列的值的脚本,亲测可用
通常数据表字段使用英文,备注comment完成字段的说明。使用该脚本能够在PowerDesigner批量生成SQL脚本时将name生成数据库中字段的comment
这个功能只能用powerdesigner 的脚本功能来实现,使用起来也简单 打开powerdesigner,shift + ctrl + X 打开脚本窗口 输入执行的脚本,点 run 即可。 简单的导入Excel脚本
PowerDesigner导出的SQL带列注释,导入到MySQL中列注释不见了的处理方法