我的power designer中有100多个表,所有表增加完后,发现每个表还要再加一个字段,且字段名称、类型和长度都相同,请问,有没有脚本可以执行?从而提高工作效率,谢谢。 问题点数:20、回复次数:6Top
I'DOY!P2,VI'ITN'J{[(http://www.itwz.net急用,谢谢各伴的回答。Top
I'DOY!P2,VI'ITN'J{[(http://www.itwz.net怎么没人呢?Top
I'DOY!P2,VI'ITN'J{[(http://www.itwz.net先生成SQLTop
I'DOY!P2,VI'ITN'J{[(http://www.itwz.net先生成SQL语句   
   然后用编辑工具查找替换,例如把   
   }   
   go   
   换成   
   ,   
   xxxx   xx   
   }   
   go   
      
   最后再用逆向工程从sql文件生成PDMTop
如果是mssql   可以执行下面的sql,给所有的用户表添加相同的字段:   
   exec   sp_MSforeachtable   @command1="if   not   exists(select   1   from   syscolumns   where   id   =   object_id('?')   and   name   =   '字段名')   alter   table   ?   add   字段名   数据类型",   
      
   然后从数据库逆工程Top
'-------------------------------   
   '或者:   执行以下vbs   
   '-------------------------------   
   Option   Explicit   
      
   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)   
      
            Dim   Tab   'running      table   
            Dim   col   
            for   each   Tab   in   folder.tables   
                     if   not   tab.isShortcut   then   
                              set   col   =   tab.columns.createnew   
                              col.code   =   "字段code"   
                              col.name   =   "字段名称"   
                              col.datatype   =   "字段数据类型"   
                     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
Tags(标签):pd用
天天网摘 Copyright(版权所有) © 天天网摘 2001~2009 本站文章来源于网络,如果有侵犯你的权宜的地方,请指出我们会即时更正。  |