Created
April 17, 2017 18:05
-
-
Save ignas-sakalauskas/fe19c27de9a4c7f9f6b8df0df5f9b6e9 to your computer and use it in GitHub Desktop.
SQL Quick Row Count
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT so.name 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 | |
-- https://ignas.me/tech/sql-quick-row-count/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment