Wednesday, 11 March 2015

List Of Table having No Index in SQL

This script  will show table without any index:

SELECT a.name FROM sys.tables a
left join sys.indexes b
ON a.object_id = b.object_id
WHERE isnull(b.name,'')=''
and not exists (select 1 from sys.indexes c where isnull(name,'')<>''
and c.object_id=b.object_id)
ORDER BY a.name

No comments:

Post a Comment