PowerDesigner导入sql脚本
转载
1.依次点击File->Reverse Engineer->Database...
2.弹出弹窗对模型进行命名,同时在DBMS下拉选择框中需要选择自己对应的数据库类型,点击确定
- 新的弹窗,选中Using script files,再点击红圈中,选中你的sql脚本位置,点击确定
- 结果图
如何让Name里面的值显示的是comment里面的值
在使用REVERSE ENGINEER从数据库反向生成PDM的时候,PDM中的表的NAME和CODE事实上都是CODE,为了把NAME替换为数据库中Table或Column的中文Comment,可以使用以下脚本:
在PowerDesigner中使用方法为:
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
结果:
版权声明
转载 本文转载自 https://blog.csdn.net/qq_36090463/article/details/94732758所有权利均归原文作者本人所有.侵删
发布时间:2022年03月23日 14:03:43
备案号:
闽ICP备19015193号-1
关闭特效
评论区#
还没有评论哦,期待您的评论!
引用发言