PowerDesigner里面将表中name列值拷贝到comment列
完整版见https://jadyer.github.io/2015/06/03/powerdesigner-copy-name-to-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 --------------------------------------------------------------------------------------------------------------------
* @create 2015-6-3 下午7:53:38
* @author 玄玉<http://blog.csdn.net/jadyer>
*/
' 假设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列的更多相关文章
- powerdesigner 将表中name列值复制到comment列 (保留原有comment)
/** * PowerDesigner里面将表中name列值复制到comment列 * @see --------------------------------------------------- ...
- 【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 Server 将一个表中字段的值复制到另一个表的字段中
具体方法如下 一:update 表2 set (要插入的列名)= select 表1.某一列 from 表1 left jion 表2 on 表1和表2的关联 where ..... 二:update ...
随机推荐
- 深入理解Redis(一)——高级键管理与数据结构
引语 这个章节主要讲解了三部分内容: 如何设计并管理Redis的键以及与其关联的数据结构: 了解并使用Redis客户端对象映射器: 介绍如何利用大O标记来评估Redis性能. 键与数据结构 键 我们先 ...
- [hihocoder][Offer收割]编程练习赛60
hohahola #pragma comment(linker, "/STACK:102400000,102400000") #include<stdio.h> #in ...
- C# FormClosing FormClosed 区别详解
FormClosing事件 在窗体关闭时,FormClosing事件发生.此事件会得到处理.从而释放与窗体相关的所有资源. 如果取消此事件,则窗体仍然保持打开状态. 当窗体显示为模式对话框时,单击“关 ...
- SLAM: Structure From Motion-移动中三维场景重建
wiki链接:https://en.wikipedia.org/wiki/Structure_from_motion 三维重建: 三维物体建模总结 1. 视野内三维物体重建 : Kinect fusi ...
- 面试回答问题要防范hr的陷阱
面试技巧是大众化的,比较实在.在经历的各种面试中,最不容易防范的面试就是“拉呱”(山东方言,聊天的意思),这样子自己容易放松警惕. 看看下面的,就知道应该怎么应对这些“滑头”的HR! 1.我们为什么要 ...
- C# MVC 延时
[System.Runtime.InteropServices.DllImport("kernel32.dll")] static extern uint GetTickCount ...
- sql server 查询数据判断为空
and xxx is NOT null and xxx is null
- python迭代器,生成器,推导式
可迭代对象 字面意思分析:可以重复的迭代的实实在在的东西. list,dict(keys(),values(),items()),tuple,str,set,range, 文件句柄(待定) 专业角度: ...
- .Net Core 中X509Certificate2 私钥保存为 pem 的方法
在自己签发CA证书和颁发X509证书时,私钥通过下面的方法保存为PEM 相关代码可以已经提交在了 https://github.com/q2g/q2g-helper-pem-nuget/pull/13 ...
- PAT_A1110#Complete Binary Tree
Source: PAT A1110 Complete Binary Tree (25 分) Description: Given a tree, you are supposed to tell if ...