1、在设计PDM文件的时候,设计一张表,在填写栏位的时候,如果我们输入Name,Code会跟着变化:
Step 1:菜单栏找到Tools,找到General Options,点击
Step 2:打开Dialog将Operating modes中的 Name To Code mirroring 將前面的勾去掉
2、Table表中 Name与Comment互转(PowerDesigner->Tools->Execute Commands->Edit/Run Scripts)
Step1 将Name中的字符COPY至Comment中:
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 comment 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
Step2 将Comment中的字符COPY至Name中
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
For Each f In folder.Packages
if not f.IsShortcut then
ProcessFolder f
end if
Next
end sub
3、Table编辑中没有看到Comment属性,可按照以下开启
双击某个table,选中页签“columns”,在其下方最右边倒数第二个按钮(Ctrl+U),将Comment打钩,确定即可
4、生成的SQL语法中表名及字段名称含有双引号
打开cdm,Tools-Model Options-Naming Convention,把Name和Code的标签的Charcter case选项设置成Uppercase或者Lowercase,只要不是Mixed Case就好
或者选择Database->Edit current database->Script->Sql->Format,有一项CaseSensitivityUsingQuote,它的 comment为“Determines if the case sensitivity for identifiers is managed using double quotes”,表示是否适用双引号来规定标识符的大小写,可以看到右边的values默认值为“YES”,改为“No”即可!
或者在打开pdm,进入Tools-Model Options-Naming Convention,把Name和Code的标签的Charcter case选项设置成Uppercase就可以!
5、pdm生成建表脚本时,字段超过15个字符发生错误(oracle)
Database - Edit Current DBMS -script-objects-column-maxlen,把value值调大(原为30),比如改成60