Tuesday, February 17, 2015

Get the list of tables which does not have Indexes

Here is the quickest way to know the list tables in SQL Server which doesn't have Indexes.

This will be very useful when we have large number of tables in our SQL Server database.


SELECT DISTINCT so.object_id,
                so.NAME
FROM   sys.indexes si
       INNER JOIN sys.objects SO
               ON SO.object_id = si.object_id
WHERE  SO.type = 'U'
       AND si.index_id = 0 



I am sure  there are many other ways to get the same list.. this is one of them.

No comments:

Post a Comment