select * from (
select tableName,colName,COUNT(1) as icount,min(indexName) as indexname from (
select*from(
select d.name as tableName,c.name as colName ,a.name as indexName,d.type
from sys.indexes a, sys.index_columns b ,sys.columns c ,sys.objects d
where a.index_id=b.index_id
and a.object_id=d.object_id
and b.column_id=c.column_id
and b.object_id=d.object_id
and b.object_id=c.object_id
and d.type='U'
) a
) a group by tableName,colName
) a where icount>1
查询SQL重复索引,索引重复检测
最新推荐文章于 2022-08-06 08:00:00 发布