powerdesigner生成数据库扩展的两种方式

闲着搞搞,生成扩展的地方,平常用pb扩展属性,总要加几个扩展表到库。所以想着第二种解决办法。

加入pd扩展的两种方法 (sqlserver)
1.
model->modele extended definition 定义扩展属性
,import an EXtended Model Definition
选 PowerBuilder
tools->powerbulider->generate   extended   attributes
此方法会导入到sqlserver中四个多余的表

2.
自定义dbms方法 原文
finally supports comments in SQL Server 2000, but PowerDesigner (even the latest version, 9.5) doesn’t know it yet. The good news is that you can easily correct this problem. Before we get started, remember that editing the database definition files is not something to be taken lightly. For this reason, I advise making all changes to a copy of the original definition file. Personally, I have marked all original files as read-only, just to be safe. Here is how you copy the definition file: Click on Tools -> Resources -> DBMS Click on the New icon on the toolbar Make the name something like "{original name} - modified" Select the source file from the pull-down list and click OK When prompted to save the file, find the original file name and append something, like "-mod" Now you will see your modified version just after the original version in the list of DBMS definitions After the file is saved, the new definition file will automatically open for editing Change the name, again by adding " - modified" to match the name used earlier Once you have the definition file open for editing, you will need to put the proper syntax in for adding table and column comments: Expand the Script, Objects and Table nodes Select TableComment (If it doesn’t exist, right-click Table, select Add Items, and select the TableComment item.) In the Value field, paste this string: [execute ]sp_addextendedproperty N’MS_Description’, N%.q:COMMENT%, N’user’, N%.q:OWNER%, N’table’, N%.q:TABLE% Now switch over to the Column object. Select ColumnComment (or add it if it doesn’t exist) In the Value field, paste this string: [execute ]sp_addextendedproperty N’MS_Description’, N%.q:COMMENT%, N’user’, N%.q:OWNER%, N’table’, N%.q:TABLE%, N’column’, N%.q:COLUMN% That’s it. Close the definition and the list of definitions dialog boxes. You will be prompted if you really want to save the changes. Click the Yes button. Now you will need to change your models that are pointing at the original SQL Server definition to use your new one. Open a model and click Database -> Change Current DBMS. Select your modified version and click OK. -> Before moving on to the next model, take a moment to enable comments (which were originally greyed out). Click Database -> Generate Database. Under Tables and Columns, check the Comment checkbox. Repeat these steps for each of your models. If you have played with the VB scripts, and you have a lot of models to switch, you can do that last bit all at once with a single script. Ah, but that would be another article
主要操作:
(1) Tools -> Resource ->DBMS
单击new ->Name项输入自定义的名称  Copy from 选择Microsoft SQL Server 2000
(2)单击"ok" 保存.xdb文件
(3)此时出现DBMS Properties界面,在general选项卡中
Script->Objects->Table->TableComment
在value项中复制以下内容 覆盖原内容
[execute ]sp_addextendedproperty N'MS_Description', N%.q:COMMENT%, N'user', N%.q:OWNER%, N'table', N%.q:TABLE%
Script->Objects->Column->ColumnComment
在value项中复制以下内容 覆盖原内容
[execute ]sp_addextendedproperty N'MS_Description', N%.q:COMMENT%, N'user', N%.q:OWNER%, N'table', N%.q:TABLE%, N'column', N%.q:COLUMN%
(4)Database->Change Current DBMS 中选中刚建成的DBMS

(5) general database时,选中table 和column下的comment复选框。
(6)注意事项: 在sql2000或2005中每个表的owner不能为空,为空无法加扩展
修改方法为:双击表 Owner:中选dbo.如果没有,可以单击右侧按钮添加一个。

 

其实主要用的还是sqlserver的sp_addextendedproperty 方法
execute sp_addextendedproperty N'属性名', N'属性值', N'对象类型', N'所有者', N'table', N'表名',, N'列名', N'列标识'

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值