欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

查询哪些表没有聚集索引

程序员文章站 2022-06-05 12:18:10
...
--查询哪些表没有聚集索引
SELECT * FROM (
	SELECT t.name AS tableName,(SELECT TOP 1 name FROM sys.indexes AS i WHERE i.type_desc='CLUSTERED' AND t.[object_id]=i.[object_id]) AS clusteredIndexName 
	FROM sys.tables AS t 
)AS t
WHERE clusteredIndexName IS NULL
ORDER BY tableName