Row counts.sql
-- Row counts of all user tables, largest first (SQL Server).SELECT s.name AS [schema], t.name AS [table], SUM(p.rows) AS [rows]FROM sys.tables tJOIN sys.schemas s ON s.schema_id = t.schema_idJOIN sys.partitions p ON p.object_id = t.object_id AND p.index_id IN (0, 1)GROUP BY s.name, t.nameORDER BY [rows] DESC;