Finding missing clustered indexes in SQL Server Database


Execute the following SQL Server script in Management Studio Query Analyzer to list tables
missing a clustered index.
 USE AdventureWorksDW;

SELECT   DISTINCT [Table] = object_name(object_id)

FROM     sys.indexes

WHERE    index_id = 0

         AND objectproperty(object_id,’IsUserTable’) = 1

         AND objectproperty(object_id,’IsMSShipped’) = 0

ORDER BY [Table]

GO
/* Results

Table

AdventureWorksDWBuildVersion

DatabaseLog

FactCurrencyRate

FactFinance

FactInternetSales

FactInternetSalesReason

FactResellerSales

FactSalesQuota

ProspectiveBuyer

*/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: