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

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

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 [表名]