返回顶部

收藏

获取SQL Server数据库中的聚簇索引信息

更多
SELECT t.NAME [表名]
    ,ix.NAME [聚簇索引名称]
    ,c.NAME [聚簇索引包括字段]
FROM sys.indexes ix
INNER JOIN sys.tables t ON ix.object_id = t.object_id
    AND ix.type_desc = 'CLUSTERED'
    AND t.type = 'U'
INNER JOIN sys.index_columns ic ON ic.index_id = ix.index_id
    AND ix.object_id = ic.object_id
INNER JOIN sys.columns c ON ic.column_id = c.column_id
    AND ic.object_id = c.object_id
ORDER BY [表名]  

标签:sql

收藏

0人收藏

支持

0

反对

0

发表评论