相关疑难解决方法(0)

SQL Server DB中所有索引和索引列的列表

如何获取SQL Server 2005+中所有索引和索引列的列表?我能得到的最接近的是:

select s.name, t.name, i.name, c.name from sys.tables t
inner join sys.schemas s on t.schema_id = s.schema_id
inner join sys.indexes i on i.object_id = t.object_id
inner join sys.index_columns ic on ic.object_id = t.object_id
inner join sys.columns c on c.object_id = t.object_id and
        ic.column_id = c.column_id

where 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 …
Run Code Online (Sandbox Code Playgroud)

t-sql sql-server indexing reverse-engineering

331
推荐指数
13
解决办法
62万
查看次数

标签 统计

indexing ×1

reverse-engineering ×1

sql-server ×1

t-sql ×1