在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语句:
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
sysusers u
join sysobjects o on (o.uid = u.uid)
join sysindexes i on (i.id = o.id)
join sysindexkeys k on (k.id = i.id and k.indid = i.indid)
join syscolumns c on (c.id = k.id and c.colid = k.colid)
where i.indid between 1 and 254
[ and o.name = %.q:TABLE% ]
[ and u.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