首页 powerdesigner 向 sql server 添加表注释和列注释(powerdesigner 向 sql server 添加表注释和列注释)

powerdesigner 向 sql server 添加表注释和列注释(powerdesigner 向 sql server 添加表注释和列注释)

举报
开通vip

powerdesigner 向 sql server 添加表注释和列注释(powerdesigner 向 sql server 添加表注释和列注释)powerdesigner 向 sql server 添加表注释和列注释(powerdesigner 向 sql server 添加表注释和列注释) powerdesigner 向 sql server 添加表注释和列注释 (powerdesigner 向 sql server 添加表注释和列注释) Abstract: how to enable PowerDesigner to support automatic generation of tables and column annotation scrip...

powerdesigner 向 sql server 添加表注释和列注释(powerdesigner 向 sql server 添加表注释和列注释)
powerdesigner 向 sql server 添加表注释和列注释(powerdesigner 向 sql server 添加表注释和列注释) powerdesigner 向 sql server 添加表注释和列注释 (powerdesigner 向 sql server 添加表注释和列注释) Abstract: how to enable PowerDesigner to support automatic generation of tables and column annotation scripts with SQL Server 2000 [conversion] PowerDesigner is a famous product of Sybase company. I started from 16-bit's windows and contacted and used this tool. It should be said to have deep feelings. PowerDesigner is a powerful tool for DBA and software architects. With the upgrade of the version, PowerDesigner provides more and more powerful functions. From the beginning of this article, introduce some of the skills in PowerDesinger to help you use this CASE tool better and more efficiently. Put forward the problem I have seen in many online friends asked, in the PowerDesigner Physical Model design, in addition to Oracle, other database model, and finally generate time to build the database scripts, automatically record tables and columns annotated database script code will not. Please allow me to explain the concept of the problem, we through the PowerDesigner Oracle database design, finally get the script can be like this, a comment statement is indicated above I save notes information in the Oracle script in the Oracle statement for execution, can get the information by querying the Oracle data dictionary. The advantage of this is that it is more convenient to look at the table structure in the future, and it doesn't need to be searched from the database document data, so it has practical significance for team development. /*===============================================*/ Table: EMP / * * / /*==============================================*/ Create table EMP "EmpID" NUMBER, "EmpName" VARCHAR2 (50), SEX CHAR (1) ) / Comment on table EMP is' staff information / Comment on column EMP. "EmpID" is "staff number" / Comment on column EMP. "EmpName" is' staff name / Comment on column EMP.SEX is' gender F: female M: male ' / SQL Server also has such a statement, however, we often find the selected database model is SQL Server, when generating a database script automatically, even if you choose the option to generate comment statements, PowerDesigner will not help you automatically, PowerDesigner does not support the SQL Server, the answer is obviously negative. Problem solving PowerDesigner model design, this tool can support any relational database because the PowerDesigner feature is defined for each kind of database model is stored in a XdB file, we can in the [PowerDesigner_Install_Home]/Resource Files/DBMS can be found. Of course, we can also create a new XdB by ourselves, defining the characteristics of the database model that we want to support. With this in mind, the answer to the question is obvious. Let me just explain briefly, I'm using the PowerDesinger9.5 enterprise edition. Sybase some simplified versions (such as SQL Moduler) can not customize XdB, please pay attention to. 1 from the menu TOOLS->RESOUCES->DBMS, enter the custom data model, see figure 1. Figure 1 2 PowerDesigner pops up a dialog box that lists the current PowerDesigner support Database model (Figure 2). We choose to create a new one. Enter the name SQL SERVER 2000 (EXTENDED), and choose to copy from the existing SQL SERVER 2000, so that SQL SERVER 2000 (EXTENDED) contains all the features that the original SQL SERVER2000 model has (Figure 3). Figure 2 Figure 3 3 next, we need to add features to support SQL Server 2000 (Extended) to support automatic generation tables and column annotation code. PowerDesinger organizes the features of the definition in a tree structure (Figure 4), and the job of this article is to define the Script code features. We need to modify script feature codes in Script\Objects\Table\TableComment and Script\Objects\Column\ColumnComment. 4 SQL Server 2000 saves table and column annotations in the database by calling the system stored procedure sp_addextendedproperty. So we just need to write them separately The annotation code at table level is: EXECUTE sp_addextendedproperty N 'MS_Description', N '%COMMENT%', N 'user', N '%OWNER%', N 'table', N '%TABLE%', NULL, NULL Column level annotation code is EXECUTE sp_addextendedproperty N 'MS_Description', N '%COMMENT%', N 'user', N '%OWNER%', N 'table', N '%TABLE%', N 'column', N '%COLUMN%' If you look at the code, you'll see what's going on right now (Figure 5). %COMMENT% and so on are equivalent to replacement variables, and PowerDesigner automatically replaces the value of the replacement variable in the design model when the script is generated. Figure 4 Figure 5 5 save SQL Server 2000 (Extended) into a XdB file. 6 now, we can create a new Physical Data Model, and the database model selects SQL Server 2000 (Extended). To build a table, it needs to be reminded that you must specify a database user, and generally use dbo (Figure 6). We can add annotations to tables and columns. Figure 6 7 generate database script, menu Databases->Generate Database. In the dialog box shown in Figure 7, notice that the comment option should be selected. Click OK to get the final build script. Open it and see that PowerDesinger generates the corresponding code according to the rules we've told it ... EXECUTE sp_addextendedproperty N 'MS_Description', N 'employee information', N 'user', N 'dbo', N 'table', N 'Employee', NULL, NULL Go EXECUTE sp_addextendedproperty N 'MS_Description', N 'primary key ID, automatically added', N 'user', N 'dbo', N 'table', N 'Employee', N 'column', N 'EmployeeID' Go ... . 8 we execute this corner in SQL Server 2000, and then we can see these annotations through Enterprise Manager. Figure 7 Figure 8 Summary Through this practice, we can understand how PowerDesigner deals with the differences of SQL syntax between different databases, which is basically consistent with the idea of developing parameter files in our application. At the same time, we should also realize that PowerDesinger function is still more and more complex, only familiar with the use of this tool function, can really improve production efficiency. //////////================================================ 1 from menu TOOLS->RESOUCES->DBMS, enter custom data model 2 PowerDesigner pops up a dialog box, listing the database library model supported by the current PowerDesigner. We choose to create a new one. Enter the name SQL SERVER (EXTENDED), and choose to copy from the existing SQL SERVER 2005, so that SQL SERVER 2000 (EXTENDED) contains all the features that the original SQL SERVER2005 model has 3 next, We need to add features to support SQL Server 2005 (Extended) to support automatic generation tables and column annotation code. We need to modify scripts in Script\Objects\Table\TableComment and Script\Objects\Column\ColumnComment and write them separately The annotation code at table level is: EXECUTE sp_addextendedproperty N''MS_Description'', N''%COMMENT%'', N''user'', N''%OWNER%'', N''table'', N''%TABLE%'', NULL, NULL Column level annotation code is EXECUTE sp_addextendedproperty N''MS_Description'', N''%COMMENT%'', N''user'', N''%OWNER%'', N''table'', N''%TABLE%'', N''column'', N''%COLUMN%''
本文档为【powerdesigner 向 sql server 添加表注释和列注释(powerdesigner 向 sql server 添加表注释和列注释)】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_633423
暂无简介~
格式:doc
大小:26KB
软件:Word
页数:7
分类:生活休闲
上传时间:2018-04-03
浏览量:58