Getting list of Tables which are having a Row Count is Zero.

vishalneeraj-24503
Posted by vishalneeraj-24503 under Sql Server category on | Points: 40 | Views : 884
Below script will give those Tables whose Row count is zero or those have no rows.

SELECT '[' + SCHEMA_NAME(t.schema_id) + '].[' + t.name + ']' AS FULL_TABLE_NAME,
SCHEMA_NAME(t.schema_id) AS SCHEMA_NAME,t.name AS TABLE_NAME,
i.rows as ROW_COUNT
FROM sys.tables AS t
INNER JOIN
sys.sysindexes AS i
ON t.object_id = i.id
AND i.indid < 2
where rows = 0
order by 1;

Comments or Responses

Login to post response