pd用脚本追加字段。

pd用脚本追加字段。

楼主amwggyy504(小黄)2006-08-22 20:35:46 在 软件工程/管理 / Power Designer 提问

我的power   designer中有100多个表,所有表增加完后,发现每个表还要再加一个字段,且字段名称、类型和长度都相同,请问,有没有脚本可以执行?从而提高工作效率,谢谢。 问题点数:20、回复次数:6Top

1 楼amwggyy504(小黄)回复于 2006-08-22 20:36:12 得分 0

急用,谢谢各伴的回答。Top

2 楼amwggyy504(小黄)回复于 2006-08-23 09:23:50 得分 0

怎么没人呢?Top

3 楼nongly()回复于 2006-08-23 19:53:34 得分 0

先生成SQLTop

4 楼nongly()回复于 2006-08-23 19:56:49 得分 0

先生成SQL语句  
  然后用编辑工具查找替换,例如把  
  }  
  go  
  换成  
  ,  
  xxxx   xx  
  }  
  go  
   
  最后再用逆向工程从sql文件生成PDMTop

5 楼shuiniu(飞扬的梦)(我是一头只吃西红柿的水牛)回复于 2006-09-22 10:32:43 得分 0

如果是mssql   可以执行下面的sql,给所有的用户表添加相同的字段:  
  exec   sp_MSforeachtable   @command1="if   not   exists(select   1   from   syscolumns   where   id   =   object_id('?')   and   name   =   '字段名')   alter   table   ?   add   字段名   数据类型",  
   
  然后从数据库逆工程Top

6 楼shuiniu(飞扬的梦)(我是一头只吃西红柿的水牛)回复于 2006-09-28 13:33:21 得分 0

'-------------------------------  
  '或者:   执行以下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

    本站文章来源于网络,如果有侵犯你的权宜的地方,请指出我们会即时更正。

    Free Web Hosting