您的位置:首页 > 数据库

PowerDesigner 数据库设计手记

2011-04-21 17:28 211 查看
 

一、PowerDesigner生成Access2003数据库

1、创建一个空白的Access2003数据库

2、用ODBC 数据源管理器链接到创建的数据库

3、Generation DataBase -> Generation type 选择 Direct generation 选择创建的ODBC

4、点击确定,应该就OK了

 

 

二、批量处理 Comment 等于 Name 或  Name 等于 Comment 

逆向工程有时候,字段的名字跟说明,要生成数据库报告的时候需要

一下中文,可以按下面的方法批量处理。

1、先做好备份!

2、Tool - > Execute Commands -> Edit/Run Script

批量Comment等于Name.txt

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
 

批量Name等于Comment.txt

'* 执行方法:PD11 -- 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
tab.name = tab.comment
Dim col ' running column
for each col in tab.columns
col.name = col.comment
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
 

3、点击Run,OK

 

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息