Name是名称(字段描述),Code是字段名称,Comment是注释名称,ER图中显示的是Name。一般设计时,Name跟comment都设计成描述,
而设计时候常把comment写成中文,name保留跟code一致,保存完毕后,可以把comment替换到name上。当然也可以用name替换comment。具体方法如下:
1 将comment覆盖name
Option ExplicitValidationMode = TrueInteractiveMode = im_BatchDim mdl ' the current model' get the current active modelSet mdl = ActiveModelIf (mdl Is Nothing) ThenMsgBox "There is no current Model "ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) ThenMsgBox "The current model is not an Physical Data model. "ElseProcessFolder mdlEnd IfPrivate sub ProcessFolder(folder)On Error Resume NextDim Tab 'running tablefor each Tab in folder.tablesif not tab.isShortcut thentab.name = tab.commentDim col ' running columnfor each col in tab.columnsif col.comment="" thenelsecol.name= col.commentend ifnextend ifnextDim view 'running viewfor each view in folder.Viewsif not view.isShortcut thenview.name = view.commentend ifnext' go into the sub-packagesDim f ' running folderFor Each f In folder.Packagesif not f.IsShortcut thenProcessFolder fend ifNextend sub
2 将name覆盖comment
Option ExplicitValidationMode = TrueInteractiveMode = im_BatchDim mdl ' the current model' get the current active modelSet mdl = ActiveModelIf (mdl Is Nothing) ThenMsgBox "There is no current Model "ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) ThenMsgBox "The current model is not an Physical Data model. "ElseProcessFolder mdlEnd If' This routine copy name into comment for each table, each column and each view' of the current folderPrivate sub ProcessFolder(folder)Dim Tab 'running tablefor each Tab in folder.tablesif not tab.isShortcut thentab.comment = tab.nameDim col ' running columnfor each col in tab.columnscol.comment= col.namenextend ifnextDim view 'running viewfor each view in folder.Viewsif not view.isShortcut thenview.comment = view.nameend ifnext' go into the sub-packagesDim f ' running folderFor Each f In folder.Packagesif not f.IsShortcut thenProcessFolder fend ifNextend sub
以上两段代码都是VB脚本,在PowerDesigner中使用方法为: 
PowerDesigner->Tools->Execute Commands->Edit/Run Scripts 将代码Copy进去执行就可以了。
