Home » To find tables without clustered Indexes or Heaps

To find tables without clustered Indexes or Heaps

The always find the below query useful in identifying tables without clustered Indexes or Heaps

SELECT SCHEMA_NAME(t.schema_id) AS schema_name, t.name AS table_name
FROM sys.tables AS t
WHERE NOT EXISTS
(
SELECT * FROM sys.indexes AS i
WHERE i.object_id = t.object_id
AND i.type = 1 -- or type_desc = 'CLUSTERED'
)
ORDER BY schema_name, table_name;
GO

Leave a Reply

Your email address will not be published. Required fields are marked *