在使用PowerDesigner对数据库进行概念模型和物理模型设计时,一般在NAME或Comment中写中文,在Code中写英文。Name用来显 示,Code在代码中使用,但Comment中的文字会保存到数据库Table或Column的Comment中,当Name已经存在的时候,再写一次 Comment很麻烦,可以使用以下代码来解决这个问题

在PowerDesigner中使用方法为:

PowerDesigner->Tools->Execute Commands->Edit/Run Scripts

将代码Copy进去执行就可以了,是对整个CDM或PDM进行操作

 1 '代码一:将Name中的字符COPY至Comment中
 2
 3
 4 Option   Explicit
 5 ValidationMode   =   True
 6 InteractiveMode   =   im_Batch
 7
 8 Dim   mdl   '   the   current   model
 9
10 '   get   the   current   active   model
11 Set   mdl   =   ActiveModel
12 If   (mdl   Is   Nothing)   Then
13       MsgBox   "There   is   no   current   Model "
14 ElseIf   Not   mdl.IsKindOf(PdPDM.cls_Model)   Then
15       MsgBox   "The   current   model   is   not   an   Physical   Data   model. "
16 Else
17       ProcessFolder   mdl
18 End   If
19
20 '   This   routine   copy   name   into   comment   for   each   table,   each   column   and   each   view
21 '   of   the   current   folder
22 Private   sub   ProcessFolder(folder)
23       Dim   Tab   'running     table
24       for   each   Tab   in   folder.tables
25             if   not   tab.isShortcut   then
26                   tab.comment   =   tab.name
27                   Dim   col   '   running   column
28                   for   each   col   in   tab.columns
29                         col.comment=   col.name
30                   next
31             end   if
32       next
33
34       Dim   view   'running   view
35       for   each   view   in   folder.Views
36             if   not   view.isShortcut   then
37                   view.comment   =   view.name
38             end   if
39       next
40
41       '   go   into   the   sub-packages
42       Dim   f   '   running   folder
43       For   Each   f   In   folder.Packages
44             if   not   f.IsShortcut   then
45                   ProcessFolder   f
46             end   if
47       Next
48 end   sub

 1 '代码二:将Comment中的字符COPY至Name中
 2
 3 Option   Explicit
 4 ValidationMode   =   True
 5 InteractiveMode   =   im_Batch
 6
 7 Dim   mdl   '   the   current   model
 8
 9 '   get   the   current   active   model
10 Set   mdl   =   ActiveModel
11 If   (mdl   Is   Nothing)   Then
12       MsgBox   "There   is   no   current   Model "
13 ElseIf   Not   mdl.IsKindOf(PdPDM.cls_Model)   Then
14       MsgBox   "The   current   model   is   not   an   Physical   Data   model. "
15 Else
16       ProcessFolder   mdl
17 End   If
18
19 Private   sub   ProcessFolder(folder)
20 On Error Resume Next
21       Dim   Tab   'running     table
22       for   each   Tab   in   folder.tables
23             if   not   tab.isShortcut   then
24                   tab.name   =   tab.comment
25                   Dim   col   '   running   column
26                   for   each   col   in   tab.columns
27                   if col.comment="" then
28                   else
29                         col.name=   col.comment
30                   end if
31                   next
32             end   if
33       next
34
35       Dim   view   'running   view
36       for   each   view   in   folder.Views
37             if   not   view.isShortcut   then
38                   view.name   =   view.comment
39             end   if
40       next
41
42       '   go   into   the   sub-packages
43       Dim   f   '   running   folder
44       For   Each   f   In   folder.Packages
45             if   not   f.IsShortcut   then
46                   ProcessFolder   f
47             end   if
48       Next
49 end   sub

转载于:https://www.cnblogs.com/chuyi-/p/9923691.html

PowerDesigner 把Comment复制到name中和把name复制到Comment相关推荐

  1. PowerDesigner中在生成的数据库脚本中用name列替换comment列作为字段描述的方法

    1 PowerDesigner中在生成的数据库脚本中用name列替换comment列作为字段描述的方法如下, 依次打开Tools – Execute Commands – Run Script,运行以 ...

  2. 复制集配置文件linux,mongodb的复制集实现

    简介: mongodb有两种类型的复制,第一种是同于MySQL的主从复制模式,第二种是复制集,提供了自动故障转移的主从复制集群.其中复制集没有固定的主节点,当一个主机的故障后从节点会重新"选 ...

  3. textview 复制粘贴_Android TextView使用剪贴板复制粘贴

    textview 复制粘贴 In this tutorial, we'll implement the copy-paste feature on a TextView in our Android ...

  4. java版mc复制tnt,教程/方块和物品复制

    此页面所述的内容是通过利用漏洞实现的. 此漏洞未必对所有版本有效.该漏洞被修复后,下文所述的信息将不再适用. 请慎重对待. 本页面会教你如何在原版生存模式中复制物品和方块,而不用为它们建造一个另外的农 ...

  5. 通往SQL Server复制的阶梯:一级- SQL服务器复制介绍

    链接:http://www.sqlservercentral.com/articles/Stairway+Series/72274/ 文章:Stairway to SQL Server Replica ...

  6. 浏览器复制粘贴以及手机端webview复制粘贴

    一.浏览器赋值粘贴 1.document.execCommand 这部分参考文档: https://developer.mozilla.org/zh-CN/docs/Web/API/Document/ ...

  7. JavaScript之浅复制【拷贝】与深复制【拷贝】【二】

    下面了解下什么浅复制[拷贝]和深复制[拷贝],通过下面的阅读你将了解到: 1.什么是浅复制以及使用场景 2.什么是深复制以及使用场景 3.浅复制和深复制有哪些方式 复制代码 一.我们先来了解下,Jav ...

  8. mysql复制模式第四部分-----环形复制

    环形复制结构图 每一台数据库服务器都是其上游数据库服务器的备库,从而使一台服务器的数据变化同时同步到其他数据库服务器. 环形复制的配置 现在环形复制的数据库为10.19.34.126.10.19.34 ...

  9. mysql二进制文件复制_MySQL 主从复制:基于二进制文件复制配置详解

    ##MySQL-主从复制:基于二进制文件复制详解 ###前言 主从复制是指把一个MySQL的数据库服务器作为主服务器(master),然后把master的数据复制到一个或者多个MySQL数据库服务器作 ...

最新文章

  1. 【spring】自动装配
  2. 前端(jQuery)(5)-- jQuery AJAX异步访问和加载片段
  3. 01. 对称密码——算法
  4. .net程序员转战android第一篇---环境部署
  5. MacOS 常用终端命令大全
  6. JQuery EasyUI DataGrid 、tree查询
  7. java deque.pop_Java ArrayDeque pop()方法
  8. ReactJs 第一章HelloWorld
  9. nginx匹配规则说明以及匹配的优先级
  10. keil中如何查看代码大小
  11. 4k电视测试软件64,2017年四款看4k视频软件推荐,智能电视必备!
  12. charles(青花瓷)抓包乱码【青花瓷抓包https内容】
  13. gateway 动态路由
  14. 读研攻略(11)—十分钟学会简历撰写,两千字无废话
  15. 前端性能优化:前端接口缓存方案
  16. c# directory.getfiles按照文件名称
  17. 微信小游戏开发新手教程14-整合到一起,做出你的小游戏
  18. 应用ArcGIS和COORD软件进行坐标七参数转换的方法
  19. HBM(高带宽内存)、GDDR SDRAM(图形双倍速率同步动态随机存储器)
  20. C# EXCEL 删除行

热门文章

  1. 电力系统的未来趋势——三维数字电网
  2. linux apt-get找不到命令,ubuntu 下 apt /apt-get command not found 命令找不到
  3. CRC校验码(附CRC7校验代码)
  4. Configuration和AutoConfiguration
  5. 软件工程-2.软件可行性研究
  6. 开工大吉:与 Apache Pulsar 社区成员相约 2023 QCon·北京站
  7. IQueryable与IEnumberable
  8. 聚米微商好做吗 、为什么这么多人都在做聚米婧氏品牌呢
  9. MATLAB数值法与微积分
  10. python:try...except、else、finally异常处理语句