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, TABLE ID, INDEX ID,CLUSTERID, UNIQUE ID,CIDXLIST...}
select
u.name,
o.name,
i.name,
case (i.status & 16 ) when 16 then ' clustered ' else '' end ,
case (i.status & 2 ) when 2 then ' unique ' else '' end ,
case (k.keyno) when 1 then '' else ' , ' end + c.name + case (Indexkey_Property(k.id,

k.indid,k.keyno,
' IsDescending ' )) when 1 then ' desc ' else ' asc ' end
from
sysusersu
join sysobjectso on (o.uid = u.uid)
join sysindexesi on (i.id = o.id)
join sysindexkeysk on (k.id = i.id and k.indid = i.indid)
join syscolumnsc on (c.id = k.id and c.colid = k.colid)
where i.indid between 1 and 254
[ ando.name=%.q:TABLE% ]
[ andu.name=%.q:SCHEMA% ]
order by
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


你可能感兴趣的:(sql,server,2000)