Get rowcount of all sql tables

08 April,2013 by Jack Vamvas

A quick method of getting the rowcount of all tables in a database is to query the sys.objects and sys.partitions views – returning the sys.partitions rows column

The query filters on sys.objects  : U = Table (user-defined) , V=View   objects.


FROM sys.objects sobj 
INNER JOIN sys.partitions spar
ON sobj.object_id = spar.object_id 
WHERE sobj.type IN ('U','V')
AND spar.index_id IN (0,1)


Read More

SQL Server - All tables row count - SQL Server DBA

How to check for SQL ghost records? - SQL Server DBA

SQL Server - sys.allocation_units - SQL Server DBA

Author: Jack Vamvas (


Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.


Post a comment on Get rowcount of all sql tables | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer