SQL Server DB中所有索引和索引列的列表如何獲取SQL Server 2005+中所有索引和索引列的列表?我能得到的最接近的是:select s.name, t.name, i.name, c.name from sys.tables tinner join sys.schemas s on t.schema_id = s.schema_idinner join sys.indexes i on i.object_id = t.object_idinner join sys.index_columns ic on ic.object_id = t.object_idinner join sys.columns c on c.object_id = t.object_id and ic.column_id = c.column_idwhere i.index_id > 0 and i.type in (1, 2) -- clustered & nonclustered only and i.is_primary_key = 0 -- do not include PK indexes and i.is_unique_constraint = 0 -- do not include UQ and i.is_disabled = 0 and i.is_hypothetical = 0 and ic.key_ordinal > 0order by ic.key_ordinal這不是我想要的。我想要的是,列出所有用戶(hù)定義的索引(這意味著沒(méi)有支持唯一約束和主鍵的索引)與所有列(按它們?cè)谒饕x中的顯示方式排序)加上盡可能多的元數(shù)據(jù)。
SQL Server DB中所有索引和索引列的列表
收到一只叮咚
2019-08-29 08:27:24