很多人都会想在使用powerdesigner设计完数据库时自动 将name列在输出时自动复制到comment列 运行脚本 tools-execute commands-edit/run scripts(快捷键:ctrlshiftx) vb脚本如下: ' 把pd中那么name想自动添加到comment里面 '如果comment为空,则填入name;
很多人都会想在使用powerdesigner设计完数据库时自动将name列值在输出时自动复制到comment列
运行脚本 tools->execute commands->edit/run scripts(快捷键:ctrl+shift+x)
vb脚本如下:
' 把pd中那么name想自动添加到comment里面'如果comment为空,则填入name;如果不为空,则保留不变,这样可以避免已有的注释丢失.option explicitvalidationmode = trueinteractivemode = im_batch dim mdl' the current model ' get the current active model set mdl = activemodel if (mdlis nothing)then msgboxthere is no current model elseif not mdl.iskindof(pdpdm.cls_model)then msgboxthe 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 if trim(tab.comment)= then'如果有表的注释,则不改变它.如果没有表注释.则把name添加到注释里面. tab.comment = tab.name end if dim col' running column for each col in tab.columns if trim(col.comment)= then'如果col的comment为空,则填入name,如果已有注释,则不添加;这样可以避免已有注释丢失. col.comment= col.name end if next end if next dim view'running view for each view in folder.views if not view.isshortcut and trim(view.comment)= then view.comment = view.name end if next ' go into the sub-packages dim f' running folder for each fin folder.packages if not f.isshortcut then processfolder f end if next end sub