I'm trying to familiarize myself with a large database and search for relevant information among the many tables. I often find myself calling up a table, to see if there is relevant data inside, only to find that the table has no records.
How to quickly call up a list of all tables and the number of records contained therein? I'm using sql server 2008.
Thanks!
Related Question: How do I QUICKLY check many sql database tables and views to see if they are not empty or contain records
Right click on database -> Reports -> Standard Reports -> Disk usage by Top Tables
If you want to use a query, you can use this (note: it's using an undocumented stored procedure sp_msforeachtable
):
create table #tempcount (tablename nvarchar(128), record_count bigint)
EXEC sp_msforeachtable 'insert #tempcount select ''?'', count(*) from ? with (nolock)'
select * from #tempcount
drop table #tempcount
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With