SDU Tools: List SQL Server user tables that are heaps (have no clustered index)

Most SQL Server tables should have a clustered index. There are some exceptions to this but it's a pretty general rule, and if in doubt, you should follow it. (Note that this is not the same as having a primary key).

I regularly come across tables without clustered indexes for all the wrong reasons. So, in our free SDU Tools for developers and DBAs, we added a tool that can look for user tables that don't have a clustered index. No surprise, it's called ListUserHeapTables because a table without a clustered index is a heap.

It takes three parameters:

@DatabaseName sysname – the database to look into
@SchemasToList nvarchar(max) – a comma-delimited list of schemas to check (or 'ALL')
@TablesToList nvarchar(max) – a comma-delimited list of table s to check (or 'ALL')

Find out more

You can see it in action in the main image above, and in the video here:

Access to SDU Tools is one of the benefits of being an SDU Insider, along with access to our other free tools and eBooks. Please just visit here for more info:

http://sdutools.sqldownunder.com

 

Leave a Reply

Your email address will not be published.