Technical Article

Get record count for every table in a DB (1 Step)

,

This is how I pull record counts for every user table in a DB... some of my tables are very large and this works for table with our without index very fast.

SELECT o.name TableName ,i.rows TblRowCount
FROM sysobjects o
 INNER JOIN sysindexes i ON (o.id = i.id)
WHERE o.xtype = 'u'
 AND i.indid < 2

Read 2,143 times
(1 in last 30 days)

Rate

4.78 (9)

You rated this post out of 5. Change rating

Share

Share

Rate

4.78 (9)

You rated this post out of 5. Change rating