![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguIhktUzfLXSCmQdagjB_ZqaeEOVHBVb_7siIjVCvcaHxf6_RRdEqno7CyfvMe4ZN3KH1J-vfqgKZGIf5zdH8IFRzfDoic5DVU6WgjV_CaDq5lEh8bA3NyYo7NLuQu9rDvq-EWy33OWHQ/s400/sql.png)
Hi all,
Below is script for finding all non empty tables in SQL Server. I found it from here , I have used it and it works. So I documented here for archive.
SELECT 'Table Name'=convert(char(25),t.TABLE_NAME), 'Total Record Count'=max(i.rows) FROM sysindexes i, INFORMATION_SCHEMA.TABLES t WHERE t.TABLE_NAME = object_name(i.id) and t.TABLE_TYPE = 'BASE TABLE' GROUP BY t.TABLE_SCHEMA, t.TABLE_NAME HAVING max(i.rows)>0
No comments:
Post a Comment