Technical Article

Count rows in all tables in a database

,

Quick way to counts rows in all tables in a database without using Count(*).

select i.rows, t.TABLE_NAME 
from INFORMATION_SCHEMA.TABLES t
inner join sysindexes i on (OBJECT_ID(t.TABLE_NAME) = i.id and i.indid < 2)

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating