首页 > 代码库 > PowerDesigner中在生成的数据库脚本中用name列替换comment列作为字段描述的方法
PowerDesigner中在生成的数据库脚本中用name列替换comment列作为字段描述的方法
1 PowerDesigner中在生成的数据库脚本中用name列替换comment列作为字段描述的方法如下,
依次打开Tools -- Execute Commands -- Run Script,运行以下脚本:
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 code 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
2 PowerDesigner的数据库逆向工程将中将comment列脚本赋值到name列
打开Tools -- Execute Commands -- Run Script,运行以下脚本:
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 code 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 thenif len(tab.comment) <> 0 thentab.name = tab.commentend ifOn Error Resume NextDim col ‘running columnfor each col in tab.columnsif len(col.comment) <>0 thencol.name =col.commentend ifOn Error Resume Nextnextend ifnextend sub
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。