I\'m using SQL Server 2005 and would like to know how I can get a list of all tables with the number of records in each.
I know I can get a list of tables using the
For what it's worth, the sysindexes system table is deprecated in SQL 2008. The above still works, but here's query that works going forward with SQL 2008 system views.
select
schema_name(obj.schema_id) + '.' + obj.name,
row_count
from (
select
object_id,
row_count = sum(row_count)
from sys.dm_db_partition_stats
where index_id < 2 -- heap or clustered index
group by object_id
) Q
join sys.tables obj on obj.object_id = Q.object_id