`

PowerDesigner反向SQL Server 2000数据库问题

 
阅读更多
<iframe align="top" marginwidth="0" marginheight="0" src="http://www.zealware.com/46860.html" frameborder="0" width="468" scrolling="no" height="60"></iframe>

在PowerDesigner中,对SQL Server 2000进行数据库反向(Database -> Reverse Engineer Database)时,会反向出一些名称以“_WA_Sys”开头的索引,但这些索引并不是我们做数据库设计的时加的,如何去掉这些不必要的索引呢,请按如下步骤进行:
1、在PowerDesigner中点击Tools-Resources-DBMS,打开“List of DBMS”窗口
2、选择Microsoft SQL Server 2000,再点击窗口上的第一个按钮“Property”
3、从左侧树菜单中展开Script -> Objects -> Index,点击SqlListQuery,在右面的Memo编辑框里看到如下SQL语句:

{OWNERID,TABLEID,INDEXID,CLUSTERID,UNIQUEID,CIDXLIST...}
select
u.name,
o.name,
i.name,
case(i.status&16)when16then'clustered'else''end,
case(i.status&2)when2then'unique'else''end,
case(k.keyno)when1then''else','end+c.name+case(Indexkey_Property(k.id,

k.indid,k.keyno,
'IsDescending'))when1then'desc'else'asc'end
from
sysusersu
joinsysobjectsoon(o.uid=u.uid)
joinsysindexesion(i.id=o.id)
joinsysindexkeyskon(k.id=i.idandk.indid=i.indid)
joinsyscolumnscon(c.id=k.idandc.colid=k.colid)
wherei.indidbetween1and254
[ando.name=%.q:TABLE%]
[andu.name=%.q:SCHEMA%]
orderby
1,2,3,k.keyno

4、在where i.indid between 1 and 254的下方加一句:
and i.name not like '%_WA_Sys%' --用于过滤SQL Server自动创建的索引
5、保存即可



Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1862721


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics