30.06.2013 Views

SQL Server Team-based Development - Red Gate Software

SQL Server Team-based Development - Red Gate Software

SQL Server Team-based Development - Red Gate Software

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Tables with no indexes<br />

233<br />

Chapter 8: Exploring your Database Schema<br />

You'd also be interested in those tables without clustered indexes, and would want to find<br />

out the reason why.<br />

SELECT DB_NAME() + '.' + Object_Schema_name(t.object_ID) + '.' + t.name<br />

AS [Tables without Clustered index]<br />

FROM sys.tables t<br />

WHERE OBJECTPROPERTY(object_id, 'TableHasClustIndex') = 0<br />

AND OBJECTPROPERTY(object_id, 'IsUserTable') = 1<br />

ORDER BY [Tables without Clustered index]<br />

Listing 8-6: Tables without clustered indexes.<br />

And you'd certainly scratch your head a bit if there were tables of any great size without<br />

any index at all.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!