SELECT name FROM sysobjects WHERE (id in (select id from sysindexes where name like '%索引%'))
--数据库中所有索引及对应的表及字段select 索引名称=a.name ,表名=c.name ,索引字段名=d.name from sysindexes a join sysindexkeys b on a.id=b.id and a.indid=b.indid join sysobjects c on b.id=c.id join syscolumns d on b.id=d.id and b.colid=d.colid where a.indid not in(0,255) -- and c.xtype='U' and c.status>0 --只要用户表及索引,则加上此条件 order by c.name,a.name,d.name--如果只要用户表及索引,不要字段,就用: select distinct 索引名称=a.name ,表名=c.name from sysindexes a join sysindexkeys b on a.id=b.id and a.indid=b.indid join sysobjects c on b.id=c.id where a.indid not in(0,255) and c.xtype='U' and c.status>0 order by c.name,a.name
FROM sysobjects
WHERE (id in
(select id from sysindexes where name like '%索引%'))
,表名=c.name
,索引字段名=d.name
from sysindexes a
join sysindexkeys b on a.id=b.id and a.indid=b.indid
join sysobjects c on b.id=c.id
join syscolumns d on b.id=d.id and b.colid=d.colid
where a.indid not in(0,255)
-- and c.xtype='U' and c.status>0 --只要用户表及索引,则加上此条件
order by c.name,a.name,d.name--如果只要用户表及索引,不要字段,就用:
select distinct 索引名称=a.name
,表名=c.name
from sysindexes a
join sysindexkeys b on a.id=b.id and a.indid=b.indid
join sysobjects c on b.id=c.id
where a.indid not in(0,255)
and c.xtype='U' and c.status>0
order by c.name,a.name