PowerDesigner 常用配置修改
转自:http://blog.sina.com.cn/u/48932504010005t9

转自:http://www.cnblogs.com/cxd4321/archive/2009/03/07/1405475.html
作者:剑飘红
在使用PowerDesigner对数据库进行概念模型和物理模型设计时,一般在NAME或Comment中写中文,在Code中写英文。Name用来显 示,Code在代码中使用,但Comment中的文字会保存到数据库Table或Column的Comment中,当Name已经存在的时候,再写一次 Comment很麻烦,可以使用以下代码来解决这个问题:
- 代码一:将Name中的字符COPY至Comment中
Option ExplicitValidationMode = TrueInteractiveMode = im_BatchDim mdl ' the current model' get the current active modelSet mdl = ActiveModelIf (mdl Is Nothing) ThenMsgBox "There is no current Model "ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) ThenMsgBox "The current model is not an Physical Data model. "ElseProcessFolder mdlEnd If' This routine copy name into comment for each table, each column and each view' of the current folderPrivate sub ProcessFolder(folder)Dim Tab 'running tablefor each Tab in folder.tablesif not tab.isShortcut thentab.comment = tab.nameDim col ' running columnfor each col in tab.columnscol.comment= col.namenextend ifnextDim view 'running viewfor each view in folder.Viewsif not view.isShortcut thenview.comment = view.nameend ifnext' go into the sub-packagesDim f ' running folderFor Each f In folder.Packagesif not f.IsShortcut thenProcessFolder fend ifNextend sub
--------------------------------------------
另外在使用REVERSE ENGINEER从数据库反向生成PDM的时候,PDM中的表的NAME和CODE事实上都是CODE,为了把NAME替换为数据库中Table或Column的中文Comment,可以使用以下脚本:
- 代码二:将Comment中的字符COPY至Name中
Option ExplicitValidationMode = TrueInteractiveMode = im_BatchDim mdl ' the current model' get the current active modelSet mdl = ActiveModelIf (mdl Is Nothing) ThenMsgBox "There is no current Model "ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) ThenMsgBox "The current model is not an Physical Data model. "ElseProcessFolder mdlEnd IfPrivate sub ProcessFolder(folder)On Error Resume NextDim Tab 'running tablefor each Tab in folder.tablesif not tab.isShortcut thentab.name = tab.commentDim col ' running columnfor each col in tab.columnsif col.comment="" thenelsecol.name= col.commentend ifnextend ifnextDim view 'running viewfor each view in folder.Viewsif not view.isShortcut thenview.name = view.commentend ifnext' go into the sub-packagesDim f ' running folderFor Each f In folder.Packagesif not f.IsShortcut thenProcessFolder fend ifNextend sub
以上两段代码都是VB脚本,在PowerDesigner中使用方法为:
PowerDesigner->Tools->Execute Commands->Edit/Run Scripts
将代码Copy进去执行就可以了,是对整个CDM或PDM进行操作
----------------------------------------------------------------------------------------------
PowerDesigner中配置外键关系时,
如果要删除配置的外键关系,
默认设置会一同删除外键列.
要更改此设置,
需在菜单栏tools中打开Model Options,
在Model Settings中点击Reference,
然后把"Auto-migrate columns"[自动移除列]这个checkbox的勾去掉,即可.
------------------------------------------------------------------------------------
让PowerDesigner自动使用Name作为备注
Database->Database Generation
------------------------------------------------------------------------
去掉 Chinese_PRC
今天在使用PowerDesigner 16设计数据库时,导出的sql语句在SqlServer中执行时,意外的让人悲催、抓狂、甚至想自杀!!!
其中就有如题这样的一个错误,看下面sql语句:

- create table dbo.t_call_note ( id int identity(100,1), name char(19) collate Chinese_PRC_Stroke_90_CS_AS_KS_WS not null, pwd char(19) collate Chinese_PRC_Stroke_90_CS_AS_KS_WS null, constraint PK_T_CALL_INFO primary key (id) on "PRIMARY" ) on "PRIMARY" go

其中SqlServer报错:collate chinese_prc_ci_as意外。。。
上面的sql包含collate Chinese_PRC_Stroke_90_CS_AS_KS_WS not null,这是一种排序方式。
但是在执行sql时就会出现错误.如果column为int时就会报错。那么我们如果如下设置,问题不再是问题了。
解决方案:
1.点击:工具栏-》database-》edit current DBMS
2.选择数据源(以SqlServer2005为例)
Microsoft SQLServer2005\Script\Objects\Column\Add
将如下代改
改为下面代码:
- %20:COLUMN%
[%COMPUTE%?AS (%COMPUTE%):
[%.L:DATATYPE%=xml?xml
[%XMLSchemaCollection%?(
[%ContentType% ]%XMLSchemaCollection.GeneratedName%):]:%20:DATATYPE%]
[%ExtRowGuidCol%? RowGuidCol]
[%IDENTITY%? %IDENTITY%[[(%ExtIdentitySeedInc%)]
[%ExtIdtNotForReplication%? not for replication]]:[%ExtNullConstName%? constraint %ExtNullConstName%]
[ %NULL%][ %NOTNULL%]][
[%ExtDeftConstName%? constraint %ExtDeftConstName%] default %DEFAULT%]
[%CONSTDEFN%]]
保存即可。
重新生成。。。发现已经没有了。。collate chinese_prc_ci_as
惊喜!!!!
PowerDesigner 常用配置修改的更多相关文章
- Tomcat常用配置修改
Tomcat常用配置修改 说明 运行需要设置环境变量 JAVA_HOME 即JDK安装目录 tomcat 默认登录地址 http://localhost:8080 配置tomcat 1.端口设置 打开 ...
- putty常用配置修改
1.修改putty默认的颜色方案 初次使用putty时,发现默认的配色的方案看得非常难受,特别是黑色背景,深蓝色的字体,根本看不清楚,下面介绍如何更改默认的配色方案: (1)下载配置文件 首先下载注册 ...
- django->基本操作和新建项目常用配置
一.安装django pip install django==2.1.5 -U #安装django/升级最新版本 二.创建.启动django项目 django-admin startproject m ...
- PLSQL常用配置之窗口/版面保存、SQL格式化/美化、SQL注释\去掉注释等快捷键配置、登陆历史修改配置
http://blog.csdn.net/hyeidolon/article/details/8251791 PLSQL常用配置之窗口/版面保存.SQL格式化/美化.SQL注释\去掉注释等快捷键配 ...
- 【转】logback logback.xml常用配置详解(二)<appender>
原创文章,转载请指明出处:http://aub.iteye.com/blog/1101260, 尊重他人即尊重自己 详细整理了logback常用配置, 不是官网手册的翻译版,而是使用总结,旨在更快更透 ...
- 【转】logback logback.xml常用配置详解(一)<configuration> and <logger>
原创文章,转载请指明出处:http://aub.iteye.com/blog/1101260, 尊重他人即尊重自己 详细整理了logback常用配置, 不是官网手册的翻译版,而是使用总结,旨在更快更透 ...
- .net学习笔记----WebConfig常用配置节点介绍
一.配置文件入门 .Net提供了一种保存项目配置信息的办法,就是利用配置文件,配置文件的后缀一般是.config.在WinForm程序中配置文件一般是App.config.在Asp.net中一般默认是 ...
- struts2 笔记01 登录、常用配置参数、Action访问Servlet API 和设置Action中对象的值、命名空间和乱码处理、Action中包含多个方法如何调用
Struts2登录 1. 需要注意:Struts2需要运行在JRE1.5及以上版本 2. 在web.xml配置文件中,配置StrutsPrepareAndExecuteFilter或FilterDis ...
- VMware中安装CentOS7网络配置静态IP地址,常用配置和工具安装
VMware中安装CentOS7网络配置静态IP地址,常用配置和工具安装在阿里云开源镜像地址下载镜像Index of /centos/7.2.1511/isos/x86_64/http://mirro ...
随机推荐
- 扩展中国剩余定理(扩展CRT)详解
今天在$xsy$上翻题翻到了一道扩展CRT的题,就顺便重温了下(扩展CRT模板也在里面) 中国剩余定理是用于求一个最小的$x$,满足$x\equiv c_i \pmod{m_i}$. 正常的$CRT$ ...
- UML入门 之 交互图 -- 时序图 协作图详解
作者 : 万境绝尘 转载请注明出处 : http://blog.csdn.net/shulianghan/article/details/17927131 动态图概念 : 从静态图中抽取瞬间值的变化描 ...
- 解决ssh/scp报错:Someone could be eavesdropping on you right now (man-in-the-middle attack)!
主要现象:ssh/scp 失败,host key verification failed. # scp /home/iso/********.iso root@192.168.1.***:/home/ ...
- Linq基础知识小记二
书写Linq查询有两种方法,第一种是通过方法语法(也就是扩展方法),第二种是查询表达式语法. 1.方法语法 方法语法就是通过扩展方法和Lambda表达式来创建查询 (1).链式查询 这种查询方式很多语 ...
- .gitignore释疑
自己总结: *.a--匹配任意路径下的.a文件 a/--匹配任意路径下的a文件夹 a/*--匹配根目录下的文件夹a下的任意文件(等同于 /a/* 或 /a/) ----一般情况下不会有这种写法 /a ...
- Ubuntukylin-14.04-desktop(带分区)安装步骤详解
不多说,直接上干货! 成功! Ubuntukylin-14.04-desktop( 不带分区)安装步骤详解 Ubuntukylin-14.04-desktop( 不带分区)安装步骤详解 Ubuntu1 ...
- fine ui使用笔记
1.top.X.alert("保存成功"); 2.Alert.GetShowInTopReference("这是在服务器端生成的客户端事件"); 注明:1与2等 ...
- openTSDB(转)
1.OpenTSDB介绍 1.1.OpenTSDB是什么?主要用途是什么? 官方文档这样描述:OpenTSDB is a distributed, scalable Time Series Datab ...
- Java 裁剪图片
package com.test; import java.awt.image.BufferedImage; import java.io.File; import javax.imageio.Ima ...
- SVN 基本的工作循环
基本的工作循环 Subversion有许多特性.选项和华而不实的高级功能,但日常的工作中你只使用其中的一小部分,在这一节里,我们会介绍许多你在日常工作中常用的命令. 典型的工作周期是这样的: 更新你的 ...