powerdesigner 将表中name列值复制到comment列 (保留原有comment)
- /**
- * PowerDesigner里面将表中name列值复制到comment列
- * @see --------------------------------------------------------------------------------------------------------------------
- * @see pd中的pdm默认生成sql时,字段是没有注释的..想要注释的话,有2个方法
- * @see 1.也是推荐的
- * @see pdm中双击打开一个Table,到Columns选项卡中,按快捷键Ctrl+U,找到Comment并勾选即可
- * @see 而且该操作设置一次就行了,以后在新的Table中也会自动出现Comment
- * @see 设置完毕后,在添加表字段时一并写上注释,这样生成的sql中字段就会有注释了
- * @see 2.执行vbs脚本
- * @see 相较第一种方法,该方法缺点是每次生成sql前,都要执行一遍这个脚本
- * @see 执行方式为Tools-->Execute Commands-->Edit/Run Scripts,或者直接快捷键Ctrl+Shift+X
- * @see 将下面的脚本拷进去执行一遍,也可以保存为name2comment.vbs(下一次再执行的话,就可以Ctrl+O再选择name2comment.vbs即可)
- * @see --------------------------------------------------------------------------------------------------------------------
- */
' 如果comment为空,则填入name;如果comment不为空,则保留不变.这样可以避免已有的注释丢失. Option Explicit
ValidationMode = True
InteractiveMode = im_Batch 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 ' 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 f In folder.Packages
if not f.IsShortcut then
ProcessFolder f
end if
Next
end sub
powerdesigner 将表中name列值复制到comment列 (保留原有comment)的更多相关文章
- SQL Server 将一个表中字段的值复制到另一个表的字段中
具体方法如下 一:update 表2 set (要插入的列名)= select 表1.某一列 from 表1 left jion 表2 on 表1和表2的关联 where ..... 二:update ...
- 【SQL】Update中使用表别名、如何用表中一列值替换另一列的所有值
Update中使用表别名 select中的表别名: select * from TableA as ta update中的表别名: update ta from TableA as ta 如何用表中一 ...
- EF Core中,通过实体类向SQL Server数据库表中插入数据后,实体对象是如何得到数据库表中的默认值的
我们使用EF Core的实体类向SQL Server数据库表中插入数据后,如果数据库表中有自增列或默认值列,那么EF Core的实体对象也会返回插入到数据库表中的默认值. 下面我们通过例子来展示,EF ...
- Mysql中You can't specify target table for update in FROM clause错误的意思是说,不能先select出同一表中的某些值,再update这个表(在同一语句中)。
将select出的结果再通过中间表select一遍,这样就规避了错误.注意,这个问题只出现于mysql,mssql和oracle不会出现此问题. mysql中You can't specify tar ...
- Oracle 11g对大表中添加DEFAULT值的NOT NULL字段速度有大幅度的提升
在一张2000万的表上增加了一个字段并字段一个默认值,执行这条语句(alter table tablename add new_col default ‘col’)一个小时没有执行完,问我有没有其他解 ...
- 如何一条sql语句查找表中第二大值
例1: 一个Customer表,一个字段Value,现请问如何查到Value中第二大的值 select max(value) from Customer where value < (selec ...
- oracle将一个表中字段的值赋值到另一个表中字段(批量)
面积表中数据错误,现将面积表中的sfmj字段的值改为居民信息表中匹配字段的值 update (select s.name name1,s2.name name2 from simple s,simpl ...
- 一个表中的字段值用作另一个表的In查询条件
Question表与Paper表 Paper表中字段QuestionIds存储的是Question表中字段Id的拼接后的值 如: 'f855eba1-b308-4bd7-a250-c071a0e1bd ...
- sql根据表中数量字段自动复制记录行
客户需要将表中统计好的数据还原成统计前的原始记录 例如: ID Name QTYCount100 Name1 1101 Name2 2102 Name3 3103 Name4 4104 Name5 5 ...
随机推荐
- [Objective-C语言教程]数字(13)
在Objective-C编程语言中,要以对象形式保存基本数据类型,如:int,float,bool.Objective-C提供了一系列与NSNumber一起使用的方法,一些常用重要的方法列在下表中. ...
- iOS开发之像素Compositing
假如Layer S·在Layer D上面,则最终的屏幕的颜色值如下: \[R = S + D \cdot (1- S_\alpha)\] \(R\): 最终的RGB \(S\): source col ...
- leetcode-830-Positions of Large Groups
题目描述: In a string S of lowercase letters, these letters form consecutive groups of the same characte ...
- Bad Smell (代码的坏味道)
sourcemaking 如果一段代码是不稳定或者有一些潜在问题的,那么代码往往会包含一些明显的痕迹.正如食物要腐坏之前,经常会发出一些异味一样, 我们管这些痕迹叫做 "代码异味" ...
- Log中关于start meeting在zVideoApp和zVideoUI中的流程可以搜索的几个字符串
[31356:36164:04-29/17:53:38.164:INFO:SBConfUI.cpp(940)] CSBConfUI::OnConfStatusChanged(CONF_STATUS) ...
- try语句块和异常处理
在C++中,异常处理包括: · throw表达式(throw expression) 异常检测部分使用throw表达式来表示它遇到了无法处理的问题.throw表达式抛出一个异常并把控制权转移到能处理该 ...
- [转] maven打包可运行的fat-jar的简单方法
[From] https://blog.csdn.net/tearsky253/article/details/75948721 问题 在使用“mvn package”命令编译application之 ...
- C运算符和表达式
C语言入门(5)——运算符与表达式 版权声明:本文为博主尹成联系QQ77025077,微信18510341407原创文章,欢迎转载侵权不究. https://blog.csdn.net/yinch ...
- eclipse 远程debug
[环境参数] Eclipse:Version: Mars.2 Release (4.5.2) Linux:centOS 6.5 [简述] Java自身支持调试功能,并提供了一个简单的调试工具--JDB ...
- spark第九篇:Spark操作ES
spark操作es需要elasticsearch-hadoop-xxx.jar,版本需同es版本.从5.0版本开始,支持spark2.0. 把elasticsearch-hadoop-xxx.jar放 ...