'*****************************************************************************
dim
model 'current model
set model = ActiveModel

If (model Is Nothing) Then
  MsgBox "There is no current
Model"
ElseIf Not model.IsKindOf(PdPDM.cls_Model) Then
  MsgBox "The
current model is not an Physical Data model."
Else
  ProcessTables
model
End
If

'*****************************************************************************
'函数:ProcessTables
'功能:递归遍历所有的表
'*****************************************************************************
sub
ProcessTables(folder)
  '处理模型中的表
  dim table
  for each table in
folder.tables
     if not table.IsShortCut then
        ProcessTable
table
     end if
  next
 
  '对子目录进行递归
  dim subFolder
  for
each subFolder in folder.Packages
     ProcessTables subFolder
  next

end
sub

'*****************************************************************************
'函数:ProcessTable
'功能:遍历指定table的所有字段,如果该字段是主键但不是外键,则设置为Identity
'*****************************************************************************
sub
ProcessTable(table)
  dim col
  for each col in
table.Columns
     '对于是主键且不是外键的字段设置为Identity(自增长类型)
     if col.Primary
and not col.ForeignKey and instr(lcase(col.datatype),"integer") > 0 then
        col.Identity = true
     end if
 
next
end sub

保存为文件A_SetIdentity.vbs放到安装目录下的vb
scripts文件夹

powerdesigner的pdm中ctrl+shift+x 打开运行脚本对话框
菜单栏中选择打开文件 找到A_Setidentity.vbs执行

70EF4733-6445-4BAC-9F92-AD8A086A5398|From:http://www.cnblogs.com/xuejianxiyang/p/8926694.html

PowerDesigner设置所有int主键自增脚本的更多相关文章

  1. 使用powerdesigner建模时设置主键自增的问题

    研究了一下,其实只要双击表,选择columns,再双击在你所要设为自增型的键上(比如你的id)或者右键选择Properties,弹出一个ColumnProperties 对话框,我们看到有标识 ide ...

  2. oracle 主键自增 设置----杜恩德

    <div id="topicList"> <div class="forFlow"> <div class = "pos ...

  3. 关于oracle设置主键自增的问题

    关于orcale设置主键自增的问题 关于主键Oracle中并没有提供一个直接的语句设置,对于这个oralce一般都是用序列和触发器来实现 一下又两种方法来实现 一 ,不使用触发器 创建序列: crea ...

  4. 在Oracle中设置主键自增

    转自:https://www.2cto.com/database/201705/636725.html 数据库设置主键自增">oracle数据库设置主键自增: --创建表 create ...

  5. 使用navicat操作PostPreSql创建表并设置主键自增和触发器

    使用navicat操作PostPreSql创建表并设置主键自增和触发器 1).创建递增序列 2).创建表,使用序列,设置主键递增 3)定义触发函数 自动生成时间戳函数 CREATE OR REPLAC ...

  6. erlang mnesia数据库设置主键自增

    Mnesia是erlang/otp自带的分布式数据库管理系统.mnesia配合erlang的实现近乎理想,但在实际使用当中差强人意,总会有一些不足.mnesia数据表没有主键自增的功能,但在mnesi ...

  7. EF 主键自增、级联删除

    一.主键自增 1.设置数据库中,主键自增 2.设置VS中Model1.edmx

  8. postgresql + mybatis insert主键自增方法

    postgresql + mybatis插入记录时设置自增主键方法: 一.数据库设置主键自增 1.数据库中id字段选择serial4类型后,会在默认值中生成 nextval('app_id_seq': ...

  9. oracle主键自增

    oracle主键自增 1建立数据表 create table Test_Increase(            userid number(10) primary key,  /*主键,自动增加*/ ...

随机推荐

  1. Angular material mat-icon 资源参考_Images

    ul,li>ol { margin-bottom: 0 } dt { font-weight: 700 } dd { margin: 0 1.5em 1.5em } img { height: ...

  2. HDU - 5306 剪枝的线段树

    题意:给定\(a[1...n]\),\(m\)次操作,0表示使\([L,R]\)中的值\(a[i]=min(a[i],x)\),其余的1是查最值2是查区间和 本题是吉利爷的2016论文题,1 2套路不 ...

  3. [转] vagrant系列(2):使用Vagrantfile实现集成预安装

    在我们的开发目录下,有一个文件Vagrantfile,里面包含有大量的配置信息,主要包括三个方面:虚拟机配置.SSH配置.基础配置.Vagrant是使用Ruby开发的,所以它的配置语法也是Ruby的, ...

  4. 基于 IEEE 754 标准的 单精度浮点数计算方式 (未完成)

    def dec2bin(dec): if dec < 0: s = ' dec = dec * (-1) else: s = ' e = 127 dec = float(dec) r = int ...

  5. Redis中算法之——Raft算法

    Sentinel系统选举领头的方法是对Raft算法的领头选举方法的实现. 在分布式系统中一致性是很重要的.1990年Leslie Lamport提出基于消息传递的一致性算法Paxos算法,解决分布式系 ...

  6. RT-Thread Nano移植

    RT_Thread移植:在MDK下以组件形式提供 https://pan.baidu.com/s/1miac86O#list/path=%2Fsharelink4264488348-377157516 ...

  7. (转)MySQL 日志组提交

    原文:https://jin-yang.github.io/post/mysql-group-commit.html 组提交 (group commit) 是为了优化写日志时的刷磁盘问题,从最初只支持 ...

  8. MongoDB数据库初探 --- 认识与安装 && Mongoose安装

    注意: monogdb数据在使用之后必须及时 mongodb.close()否则后台崩溃. 第一部分: MySQL数据库是关系型数据库,但是使用node开发时多用MongoDB数据库,两者各有优势,所 ...

  9. Robot Framework(Databaselibrary库操作)

    1.安装 DatabaseLibrary 库 DatabaseLibrary 下载地址:https://pypi.python.org/pypi/robotframework-databaselibr ...

  10. TortoiseGit学习系列之Git和TortoiseGit的区别

    不多说,直接上干货! Git和TortoiseGit的区别: TortoiseGit的安装和使用依赖Git.