Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
SQL Quick Row Count
SELECT as TableName, ddps.row_count as [RowCount]
FROM sys.objects so
JOIN sys.indexes si ON si.OBJECT_ID = so.OBJECT_ID
JOIN sys.dm_db_partition_stats AS ddps ON si.OBJECT_ID = ddps.OBJECT_ID AND si.index_id = ddps.index_id
WHERE si.index_id < 2 AND so.is_ms_shipped = 0
ORDER BY ddps.row_count DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment