User:Dboltv

Get number of rows in all tables of a Data Base
CREATE TABLE #counts

(

table_name varchar(255),

row_count int

)

EXEC sp_MSForEachTable @command1='INSERT #counts (table_name, row_count) SELECT '' ? '', COUNT(*) FROM ?'

SELECT table_name, row_count

FROM #counts

where row_count > 0

ORDER BY table_name, row_count DESC